LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete White Space in Strings

My project involves reading databases of strings and numbers. The
database is not flexible (I can't control what the variable names are
and more importantly, what the spacing is). I am trying to search the
database for certain variable names in a systematic way. Unfortunately
the number and location of blank spaces inconsistent, I would like to
be able to strip the strings of all white space. Is there a built in
function that I can use? Has anyone ever done anything similar? I'm
at a loss here.

For clarity, I'm looking for a way of deleting all the space characters
from my strings.


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 1 of 9
(16,862 Views)
Look at the VI located at Examples\General\Strings.llb\Search String and
Replace - General.vi

Use it to replace spaces with empty string. The input pattern is a regular
expression so you can enter [\s\t\r\n]+ and it will remove all white
characters, spaces, tabs, returns and line feeds

Take a look also to "Match Pattern" and "Scan String for Token" functions.



--
Jean-Pierre Drolet
Scientech R&D inc
Trois-Rivieres-Ouest (Quebec)
CANADA G8Z 4H1




Spencer a écrit dans le message :
8e73m4$9ka$1@nnrp1.deja.com...
> My project involves reading databases of strings and numbers. The
> database is not flexible (I can't control what the variable names are
> and more importantly, what the spacing is). I am trying to search the
> database f
or certain variable names in a systematic way. Unfortunately
> the number and location of blank spaces inconsistent, I would like to
> be able to strip the strings of all white space. Is there a built in
> function that I can use? Has anyone ever done anything similar? I'm
> at a loss here.
>
> For clarity, I'm looking for a way of deleting all the space characters
> from my strings.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Message 2 of 9
(16,862 Views)
Thanks that works great. I appreciate the quick help there.

In article <39071c32@newsgroups.ni.com>,
"Jean-Pierre Drolet" wrote:
>
> Look at the VI located at Examples\General\Strings.llb\Search String
and
> Replace - General.vi
>
> Use it to replace spaces with empty string. The input pattern is a
regular
> expression so you can enter [\s\t\r\n]+ and it will remove all white
> characters, spaces, tabs, returns and line feeds
>
> Take a look also to "Match Pattern" and "Scan String for Token"
functions.
>
> --
> Jean-Pierre Drolet
> Scientech R&D inc
> Trois-Rivieres-Ouest (Quebec)
> CANADA G8Z 4H1
>
> Spencer a écrit dans le message :
> 8e73m4$9ka$1@nnrp1.deja.com...
> > My project involves reading databases of st
rings and numbers. The
> > database is not flexible (I can't control what the variable names
are
> > and more importantly, what the spacing is). I am trying to search
the
> > database for certain variable names in a systematic way.
Unfortunately
> > the number and location of blank spaces inconsistent, I would like
to
> > be able to strip the strings of all white space. Is there a built
in
> > function that I can use? Has anyone ever done anything similar?
I'm
> > at a loss here.
> >
> > For clarity, I'm looking for a way of deleting all the space
characters
> > from my strings.
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 3 of 9
(16,862 Views)

Seach and Replace string with TRUE on replace all input... it should look like this:

 

remove all spaces.png

Message 4 of 9
(14,652 Views)

Wow bogdan,

 

you gave an answer to a 16 years old thread that was already solved…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 9
(14,644 Views)

Indeed "Knight of NI" ...

 

but you should stop being sarcastic with that "wow" ... any contribution to the forum should be appreciated and you should know that.

 

I found this thread searching google ... even if it's 16 years old. I guess other people can do the same and land here with same questions in mind. And for those, I found it more intuitive to have a print screen explaining the sollution than only plain text ... and this is why I added a reply.

 

Best regards,

Bogdan

Message 6 of 9
(14,625 Views)