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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement