Formatting Number/String Help Needed...

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Formatting Number/String Help Needed...

    Hello Friends,

    I am using ASP VBScript and i am trying to format a number/string. I am
    trying to get this:
    5982749259825982

    to look like this:
    598-7492598-5982

    I tried a Mid function but I keep getting a Type mismatch 'Mid' error.
    Here's my code:

    Dim strMyNumber
    strMyNumber = "5982749259825982 "

    If Len(strMyNumber) >= 8 Then
    Mid(strMyNumber, 4, 1) = "-"
    Mid(strMyNumber, 12, 1) = "-"
    End If

    Thanks for any help. :)

    e-roq777 Guest

  2. Similar Questions and Discussions

    1. Formatting String in Datagrid
      Hi guys, does anyone know how to format strings this way:- i have 1 column(unit_num) in my Datagrid which displays eg. "01-123" i have to...
    2. Number formatting?
      Any convenient ways (without rolling my own) of formatting numbers to include thousands separators, e.g. 1199123 printed as "1,199,123" --...
    3. Number formatting in CDML
      I know that there are periodically volumes written about number formatting in this group. Especially the problem of formatting money. Am I crazy...
    4. Formatting a number
      "Audrey" <audreybmorin3@hothotmail.com> wrote in message news:002a01c34aed$018ba760$a401280a@phx.gbl... Isn't this what the format setting of...
    5. string formatting
      I need to convert a numeric filed NUMERIC(14,3) to a string with a (european) regional currency formatting like "1.234,56". How can I achieve this,...
  3. #2

    Default Re: Formatting Number/String Help Needed...

    On 01 Apr 2005 in macromedia.dreamweaver.appdev, e-roq777 wrote:
    > Hello Friends,
    >
    > I am using ASP VBScript and i am trying to format a number/string.
    > I am trying to get this:
    > 5982749259825982
    >
    > to look like this:
    > 598-7492598-5982
    >
    > I tried a Mid function but I keep getting a Type mismatch 'Mid'
    > error. Here's my code:
    >
    > Dim strMyNumber
    > strMyNumber = "5982749259825982 "
    >
    > If Len(strMyNumber) >= 8 Then
    > Mid(strMyNumber, 4, 1) = "-"
    > Mid(strMyNumber, 12, 1) = "-"
    > End If
    Offhand, I'd guess that VBScript is assuming that strMyNumber is an
    integer. Try casting as a string (cStr):

    strMyNumber = cStr(5982749259825982)

    or

    mid(cStr(strMyNumber),4,1) = ...

    --
    Joe Makowiec
    [url]http://makowiec.net/[/url]
    Email: [url]http://makowiec.net/email.php[/url]
    Joe Makowiec Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139