LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to number

 
 
 
Hello sir,
 
              i need to increment  string for using as an filename.   000 to 001...... n so on
Please help me to do so..
 
 
Regards

Tiju Thomas
0 Kudos
Message 1 of 11
(4,112 Views)

Hi TIJU,

you can use the function "format into string". see the attached example. Hope it helps.

Mike

0 Kudos
Message 2 of 11
(4,108 Views)
Hi tiju,

where exactly is your problem?

For incrementation you find a "+1" function in the mathematics palette. For string to number conversion you can use "Scan from string" or several format specific functions from the string palette... To get the filename you can use the "strip path" function from the files palette!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(4,106 Views)
Hi!
   I'd suggest:


graziano


Message Edited by Graziano on 03-28-2008 05:16 AM
Download All
0 Kudos
Message 4 of 11
(4,099 Views)
Hello Mr Graziano..
 
 
   This is want i looked for..thanks for ur help..revert back to u for help if i need..
Thank u once again..
 
TIJU
Regards

Tiju Thomas
0 Kudos
Message 5 of 11
(4,085 Views)
Hi Graziano,

you can delete the "concat string" when you use a format string of "file%03d.ext"...
Or even better: use a format string of "%s%03d.%s" and wire filename (before number) and extension to the additional inputsSmiley Wink

And when there is only one number in the filename (or it is separated by other chars than 0-9) you can use a "split string" function with just the offset, the conversion to number will stop at non-decimal characters. You may use a "scan from string" with format "%d" and wired offset instead.


Message Edited by GerdW on 03-28-2008 11:39 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 11
(4,084 Views)
 
Thank you      Mike..
 
Thank you   GerdW
 
 
Regards

Tiju Thomas
0 Kudos
Message 7 of 11
(4,077 Views)
Yeah i needed only that number string to increment ,so i removed other stuffs in concatnate string.
Ok i'll better do that way..i need auto formating the string ie..
 if starts with  0..  1....2     incrementing....
                      00 ...01..02...
                      000...001...002..
  like this..
Regards

Tiju Thomas
0 Kudos
Message 8 of 11
(4,075 Views)

Hi TIJU,

to be more flexible you can use something like this.

Mike



Message Edited by MikeS81 on 03-28-2008 11:59 AM
0 Kudos
Message 9 of 11
(4,071 Views)


@GerdW wrote:
Hi Graziano,

you can delete the "concat string" when you use a format string of "file%03d.ext"...
Or even better: use a format string of "%s%03d.%s" and wire filename (before number) and extension to the additional inputsSmiley Wink



Hi GerdW!
   thanks, I learned something!!!!!

   Due to memory leaks (i.e. my brains always stills useful informations, or I have a brain-integrated excellent garbage collector which runs at realtime priority Smiley Happy ), I never remember format string stuffs!  One day I'm going to write a paper with examples on format strings (many things are not well documented, imho), and I'll put this!

graziano
0 Kudos
Message 10 of 11
(4,064 Views)