LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find string

Hello!

 

It seems like a simple problem, but I am stuck:

I have a string array and I want to search each cell for a certain substring:

 

house

bed

Profile "something"

car

whatever

EndProfile

GlobalProfile

 

I want to find out in which row the substring "Profile" appears (at the beginning). As the string that comes after "Profile" always changes, I cannot compare the whole string. If I find a row with the word "Profile" then I want to have the index of that row. I don't want to divide any strings, I just need said index.

 

Can someone please help me?

 

Edit:

I have tried to compare strings using an asterisk, but if I search for "Profile*" then it doesn't find anything.

0 Kudos
Message 1 of 4
(2,818 Views)

Use a For Loop to index each element individually and use Match Pattern inside to find the string with "Profile".  The loop count when you find it is your index.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 4
(2,809 Views)

Hi

 

 

You need to look at the match pattern VI or regular expression VI and learn about pattern matches simple example

 

Example_VI_BD.png

 

 

Danny Thomson AshVire Ltd
0 Kudos
Message 3 of 4
(2,806 Views)

you beat me to it Jim 🙂

Danny Thomson AshVire Ltd
0 Kudos
Message 4 of 4
(2,804 Views)