08-06-2010 08:25 AM
HI
ANYBODY know how to convert a number to a string
for example i need to convert number 1-9999 to a string, but the number below the 1000 in the string should display as 0900 for 900, the number blow 1000should add a 0 befor in front of the number in the string.
can anybody teach me how to do it?
Solved! Go to Solution.
08-06-2010 08:31 AM
Read the Detailed Help for the Number to Decimal String function. It shows how to get a fixed width string. Then you would need to replace the space characters with zeros. Or use the Format Value function with an appropriate format string.
Lynn
08-06-2010 09:04 AM
hi
I have did what you suggested, but it does not works
this is the vi
08-06-2010 09:10 AM
You did not properly read the documentation, or Lynn's response. What did you expect if you set a width of 0?
Read the help on the Format Into String function. Use %04d as your format string.
08-06-2010 09:34 AM
Like this
The VI below is in Labview 8.0
08-06-2010 09:45 AM - edited 08-06-2010 09:46 AM
@aeastet wrote:
Like this
The VI below is in Labview 8.0
What is it that they say about teaching a man to fish instead of just giving them the full course?
As for aeastat's code, it can be reduced to this:
08-06-2010 10:02 AM
Note to self: If you want your response marked as the solution make sure you provide a picture to go along with the answer, regardless of whether you explicitly stated the answer in the response. Apparently kids these days like that flashy stuff.
08-06-2010 11:17 AM
Actually, what they really like is for us to do their coding for them. I've succumbed to doing this a few times, but I try not to, and give them a description of what to do instead. They usually don't like that.
08-06-2010 11:36 AM
Most of them are allergic to the help files also.
Lynn
08-06-2010 11:48 AM
And allergic to the tutorials and shipping examples. Maybe a login to the forums could only be granted after completion of the new LabVIEW 101 tutorial. Id bet we'd see a huge drop in traffic.