LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find a character in a string

Solved!
Go to solution

Hello,

In the program I have done, in the "Sincronismo" case I want to see if the "Modelo de bloque" has the character "B" and show this with a boolean. In my case the "Modelo de bloque" is an indicator, maybe because of that I can´t use in the "Match Pattern Function". So how can I do it for my program? 

0 Kudos
Message 1 of 37
(4,448 Views)

I will give you two options, with the first being my preference.

1. Store the string value in a shift register.

2. User a Local Variable to read your indicator value.


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 2 of 37
(4,433 Views)

What is the data the you are going to have to evaluate? Is it going to be the same every time? It will be tough to look for the letter B with out finding B in other data that you may receive. Can you give examples of the different expected responses so the we can better help you find a good solution to your problem?

 

Tim
GHSP
0 Kudos
Message 3 of 37
(4,431 Views)
Solution
Accepted by topic author labview99

Use a local variable: right click on the terminal of "Modelo de bloque" and choose Create->Local Variable.

The local will be created in write mode. Right click on the variable and select "Change to Read".

Beware: use local variables only when really needed; never where you can use a regular wire.

More information on local variables in the LabVIEW help and tutorials.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 37
(4,429 Views)

I am going to receive different strings in "Modelo de bloque", for example: 111222AAABBB, ABABABAB112222, AAAB111111AAB... also I can receive strings without the letter "B", for example, 22221111112222

0 Kudos
Message 5 of 37
(4,356 Views)

@labview99  ha scritto:

I am going to receive different strings in "Modelo de bloque", for example: 111222AAABBB, ABABABAB112222, AAAB111111AAB... also I can receive strings without the letter "B", for example, 22221111112222


Fine. What's the question here?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 37
(4,353 Views)

Sorry,

Is the answer to the question of Tim

0 Kudos
Message 7 of 37
(4,351 Views)

Thank you so much for your help Paolo!!

0 Kudos
Message 8 of 37
(4,349 Views)

Hello,

I have tryed to do a program where I find the character "A" in one string and when it finds the first "A" I want to turn on the button of the array that corresponds.

I have done this program but it turns on all the "A" of the string and I want to turn on only the first A found in the string.

array.PNG

0 Kudos
Message 9 of 37
(4,303 Views)

Hi 99,

 

until now you were looking for letter "B", now you are looking for an "A"?

What's the big difference so you need to start a new thread?

 

When you only want to find the first occurance of a letter in a string then you should not compare all chars but Search1DArray to find it…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 37
(4,286 Views)