LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String

any help how can i find the number of times the letter "a" appears in the string what function i have to use. Thank you 

0 Kudos
Message 1 of 17
(3,198 Views)

Hi jiji,

 


@jiji_830 wrote:

how can i find the number of times the letter "a" appears in the string


Have you already opened the string functions palette? Have you tried any of those functions?

I would use a function which is able to replace a char and provide an output of the number of replacements…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 17
(3,190 Views)

this my attempt but I couldn't figure it out 

0 Kudos
Message 3 of 17
(3,164 Views)

Hi jiji,

 

unfortunately you decided to attach a VI in the newest LabVIEW version - which I cannot open (as indicated in my signature line)…

 

Hint: use Search&ReplaceString

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 17
(3,149 Views)

You've got your wires connected wrong.  How to find it yourself:

  1. Click on the broken run arrow (or press Ctrl-L)
  2. When the error list shows up, double-click on the error
  3. Make sure context help is showing (Ctrl-H toggles it)
  4. Move the mouse over the offending function.
  5. In the context help window you can see what the connections are.  Bold labels indicate required connections.

Move those top 2 string wires up one.

"If you weren't supposed to push it, it wouldn't be a button."
Message 5 of 17
(3,139 Views)

hi 

i attached a new example just to learn how to figure it out it is with old version i try with search replace string but not work. i enter 4 letter e in the string control but the indicator show 1. Thank u

0 Kudos
Message 6 of 17
(3,122 Views)

@jiji_830 wrote:

hi 

i attached a new example just to learn how to figure it out it is with old version i try with search replace string but not work. i enter 4 letter e in the string control but the indicator show 1. Thank u


Pay attention to your wiring.  You've got the TRUE constant wired to the wrong input. If should be wired to "replace all"

"If you weren't supposed to push it, it wouldn't be a button."
Message 7 of 17
(3,117 Views)

thank u so much. if we want to generate the number of the words in the string we use same function ??

0 Kudos
Message 8 of 17
(3,109 Views)

@jiji_830 wrote:

thank u so much. if we want to generate the number of the words in the string we use same function ??


That should work, yes. Space is a good word separator to look for. 😉

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 17
(3,071 Views)

@jiji_830 wrote:

thank u so much. if we want to generate the number of the words in the string we use same function ??


Yes, but simply searching for spaces won't work because it won't handle multiple spaces and it ignores other whitespace and it would be confused by leading/trailing whitespace.  Use this:

cw.png

Note: Right-click on the "Search and Replace String" function to toggle "Regular Expression" mode,

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 10 of 17
(3,043 Views)