Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Formatting Strings
Message
From
08/10/2004 14:41:07
 
 
To
08/10/2004 05:27:51
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00949820
Message ID:
00949996
Views:
12
Hi, Martin-

You might instead use a Regex expression and pad the right side of your string.

>Good afternoon to all! Is there an easier way to format a string? Like my account code is a string and should be formated 999-999-99. I can't make use of the mid function as the code will be too long especially since the value of the account code can vary in length (between 1-8 characters).
>
>I tried making use of the Format command which works well only if the string contains 8 characters. If it containst less, it is still formatted but in the wrong way:
>
>x="12345"
>x=format(val(x),"000-000-00")
>
>Result:
>
>"000-123-45"
>
>Ideally it should look like:
>
>"123-45 - "
>
>The reason for the VAL function is that if I pass the string to the Format function it returns:
>
>"000-000-00"
>
>Any ideas?
>
>Thanx! in advance :)
Previous
Reply
Map
View

Click here to load this message in the networking platform