LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I eliminate spaces from a file?

I am trying to read in a list of numbers from a file, each line has two numbers with a space in the middle how can I eliminate the space and just read in each number?
0 Kudos
Message 1 of 13
(3,450 Views)
Couldn't you just use "Read from spreadsheet file" and wire a "space" character as delimiter?

If this does not work right, you might have variable numbers of consecutive spaces. Please post a sample data file so we can see what's best).
0 Kudos
Message 2 of 13
(3,450 Views)
There is also a "remove white space" icon available in the additional strings functions.
0 Kudos
Message 3 of 13
(3,450 Views)
Thank you for your help. Is the "remove white space" icon only in certain versions or do I have to add it in, because I do not have it on mine. I have version 6.1.
0 Kudos
Message 4 of 13
(3,450 Views)
I tried using the "Read from speardsheet file" with the space as the delimiter and it only read the numbers before the space for some reason. I am not sure why.
0 Kudos
Message 5 of 13
(3,450 Views)
Hi MollyHix,

If the file is already opened and you wish to re-format the string by removing the white space, you may want to try the following:

Wire the string to the "Search and Replace String.vi" which is located in the FUnctions Palette under "String".
Right-click on "Search String" and create Constant.
Right-click on the new constant and select "\" Codes Display.
Type \s
At the top (or actually middle) of the "Search and Replace String.vi", wire TRUE for "replace all".
Wire an empty string constant "" to "replace String".

The result string should give you a string without white space.

-Enjoy-

JLV
Message 6 of 13
(3,450 Views)
here is a small example
Message 7 of 13
(3,450 Views)
That did it!!Thank you so much!! I had version 6.1 so I could not see your example but, your step by step instructions were so helpful THANK YOU!! Molly
0 Kudos
Message 8 of 13
(3,450 Views)
I'm glad it worked..

I keep forgetting to transfer my examples to LV6.1..

🐵
Message 9 of 13
(3,450 Views)
Joe,

Could you elaborate a little on what is going on when one selects "/" Codes Display , is there a list of codes somewhere to reference as to what codes to use to do a particular task.

thanks
0 Kudos
Message 10 of 13
(3,450 Views)