Jump to content
Sign in to follow this  
Kalle_76

Number to String

Recommended Posts

Hi All!

I have number that I want to convert to a string. The number can be anything between 0 and 9999.

I what the string to always have 4 characters.

For example the number 34 should be 0034 after conversion, 560 should be 0560, 6734 should be 6734.

I know I can use sting functions to seen how many characters there are and then add zeros in front, but my guess is there is a simpler way to do this.

Any ideas?

Best regards, Kalle

Share this post


Link to post
Share on other sites

Use the "Format into String" primative (it's under the "string" sub-palette of the functions palette), and set your "format string" to %04d - the % is the format sepcifier, the 04 means use a minimum field width of 4 characters, and the d tells the function to format is as an integer.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.