LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NUMBER CONVERT TO STRING

Solved!
Go to solution

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?

0 Kudos
Message 1 of 10
(4,103 Views)

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

0 Kudos
Message 2 of 10
(4,101 Views)

hi

  I  have did what you suggested, but it does not works

  this is the vi

0 Kudos
Message 3 of 10
(4,084 Views)

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.

0 Kudos
Message 4 of 10
(4,076 Views)
Solution
Accepted by topic author lilight

Like this

 

20837i858A0BCB03AF03C9

 

The VI below is in Labview 8.0

Tim
GHSP
0 Kudos
Message 5 of 10
(4,062 Views)

 


@aeastet wrote:

Like this

 

20837i858A0BCB03AF03C9

 

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:

 

0 Kudos
Message 6 of 10
(4,053 Views)

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. Smiley Very Happy

0 Kudos
Message 7 of 10
(4,037 Views)

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.

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 10
(4,027 Views)

Most of them are allergic to the help files also.

 

Lynn

0 Kudos
Message 9 of 10
(4,019 Views)

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.

0 Kudos
Message 10 of 10
(4,007 Views)