LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove preceding “\s” characters from string. . .

Hello,

I wish to remove preceding space characters (\s) from a string.
However, I do not wish to remove all \s characters from the string as they’re important.
In my case, the \s characters are used to pad the string and must be removed prior to converting the string to a path.
The “data” portion of the string is of a variable length.
Please refer to the attached image, which illustrates what I’m trying to accomplish.
Thank you in advance for your time.

-Joshua.Robot


0 Kudos
Message 1 of 6
(3,776 Views)
Trim Whitespace in the String palette.

Out of curiosity: Why is the string padded?


Message Edited by smercurio_fc on 01-09-2008 05:31 PM
0 Kudos
Message 2 of 6
(3,773 Views)

Thanks for the tip. (I must have tried every string VI but that!)
In answer to your question, the program I'm creating must associate certain data with an image, stored in one file. However, this data header must be compatible with multiple systems. To get around this, I've designed a header of a fixed length (with each field being of a fixed length as well) so it can be parsed by index or delineator.
Thanks again,
Joshua.Robot

0 Kudos
Message 3 of 6
(3,742 Views)


robotbuilder wrote:
In answer to your question, the program I'm creating must associate certain data with an image, stored in one file. However, this data header must be compatible with multiple systems. To get around this, I've designed a header of a fixed length (with each field being of a fixed length as well) so it can be parsed by index or delineator.

Compatibility with multiple systems should also include multiple OS. 😉 In this case you should avoid any string representation of paths, but use the the special Path datatype.
 
Instead of doing a string concatenation, you would then use "built path" to add the filename.
 
Overall, a fixed field lenght for paths is a bad idea because it has become my experience that paths tend to become longer and longer in the future. How many characters do you have reserved?
0 Kudos
Message 4 of 6
(3,737 Views)


@altenbach wrote:

. . .Instead of doing a string concatenation, you would then use "built path" to add the filename.
 
Overall, a fixed field lenght for paths is a bad idea because it has become my experience that paths tend to become longer and longer in the future. How many characters do you have reserved?


Thanks, I will try the "Build Path".
The decision to go with fixed length header fields was a compromise necessary to maintain compatibility with a proprietary and archaic medical file system. Unfortunately, many of these decisions are out of my control.

Each header field is fixed at the maximum anticipated length for that particular piece of data. For example, including delineators, the time / date stamp field has a fixed width of 26 characters. The file path field is set at the maximum length allowed for the Windows NT file structure.

I’ll stop there before I reveal more of my ignorance. (I’m just a novice at this!)

Thanks for your input; I’ll be seeking it again.

-Joshua.Robot

0 Kudos
Message 5 of 6
(3,718 Views)
Maybe you could separate each field by length with the Split String or String Subset functions then clean up each piece before doing the Build Path. Store an array with the field lengths and loop through the string, creating an array of strings, one for each field.

Lynn
Message 6 of 6
(3,707 Views)