Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Formatting Strings
Message
De
08/10/2004 14:41:07
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
08/10/2004 05:27:51
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00949820
Message ID:
00949996
Vues:
13
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 :)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform