Formatting text from a database

Results 1 to 3 of 3

Thread: Formatting text from a database

  1. #1
    John Rodgers Guest

    Default Formatting text from a database

    I&#039ve been looking all over and I can&#039t seem to find the answer to my specific question. <BR><BR>I have results from a database that need to be formatted for display on a web page. In one case, an account number needs to have a dash placed between the last, and second-to-last numbers in the string. For example, account number "9437593" should read "943759-3". To compound the problem, the length of the account number will vary. Sometimes it is 6 digits, but it can be as many as 11 digits long. <BR><BR>Are there any functions I can use to perform this? I come from the AS/400 world, where can specify an Edit Word of &#039 - &#039 to format the text, but I haven&#039t seen anything similar in VBScript. <BR><BR>Any help is appreciated. Thanks in advance,<BR>John Rodgers<BR>

  2. #2
    Mark Guest

    Default RE: Formatting text from a database

    Try:<BR>string = CSTR(accountnumber) &#039converts integer Account Number to a text String<BR><BR>newstring = LEFT(string,LEN(string)-1) & "-" & RIGHT(string,1)<BR>Response.Write newstring<BR><BR>

  3. #3
    John Rodgers Guest

    Default RE: Formatting text from a database

    Sweet, thanks a million!!!<BR><BR>John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts