LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String length excluding input string/character

Solved!
Go to solution

Long story short, I want to replicate the String Length function but to not include an input string in the character count. For example:

 

The input (search) string is "the".

 

My first string to test is "The big red dog."

This would return a string length of 13.

 

My second string is "Jumps over the lazy fox."

This would return a length of 21.

 

"Hello World!" would return 12.

"The Lion The Witch And The Wardrobe" would return 26.

 

Hopefully you can see what I'm trying to achieve. How is this possble?

 

- James

 

(I am runnnig Labview 8.5)



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 1 of 7
(2,633 Views)

Take the length of both strings and subtract one from the other .......   ???

0 Kudos
Message 2 of 7
(2,623 Views)

The input (search) string may or may not be present, or it may be present multiple times. I've had a look through the various string pallets (including some addon pallets) but not found anything that appears to work like this.



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 3 of 7
(2,618 Views)
Solution
Accepted by topic author J.Mamakos

Use the Search and Replace String to replace your "exclusion string" with an empty string.  Use the String Length on the resulting string.  Make sure the Relace All is set to TRUE.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 7
(2,617 Views)

Thank you. I figured it must be fairly simple, but I just couldn't see it! Smiley Happy



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 5 of 7
(2,606 Views)

It looks like you also need to set ignore case? to True

0 Kudos
Message 6 of 7
(2,599 Views)

@Rod wrote:

It looks like you also need to set ignore case? to True


Based on the examples given, you are correct.  I just left that one up to the OP to decide if that's what they wanted.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(2,581 Views)