Welcome! Log In Create A New Profile

Advanced

Formatting a variable

Posted by Michael 
Michael
Formatting a variable
June 19, 2009 08:34AM
Hi All:

I need to build a string from numeric variables, but I need to format the string in the following way:

XXXX.YYYYYYYY

where XXXX is a number from 1 to 9999 and YYYYYYYY is a number from 1 to 99999999

What function should I use in order to complete leading 0s? I mean, if XXXX = 35, it should appear as 0035 and not just 35. ( In Clarion I use FORMAT(var,@n04) )

I was looking display masks but I think they are associated with controls, and not with variables.

Thanks in advance.

Thanks;
Michael
Stefan Bentvelsen
Re: Formatting a variable
June 19, 2009 08:51AM
Hi Michael,

NumToString(XXXX,"04d")+"."+NumToString(YYYYYYYY,"08d")

is what you are looking for.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: