LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String comparisons

Solved!
Go to solution

Greetings,

 

I  am a neophyte user (stating the obvious here) having trouble with string comparisons. The little vi attached ran an turned green one time but forever after I cannot get it to indicate green regardless of input.

 

My eventual goal will be to determine if a device is generating the string "Enter User ID:". Would 'Match True/False String' prefaced with some type of string trimming be an acceptable method?

 

Thanks,

 

jvh 

0 Kudos
Message 1 of 5
(2,513 Views)

Hi jvh,

 

the equal function is perfect for comparing string for equality!

 

Your problem is probably the switch "limit to single line", accessible via right-click of the string control. This will prevent NewLines getting added to the string content... Otherwise make the string controls bigger to show more than one line of text Smiley Wink

Best regards,
GerdW


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

OK I looked at your vi.  I have no problem getting the boolean to be True.  Just typr the same text in each string input and "enter" the varible. by one of the following means:

  1. Click the check mark in the toolbar
  2. Depending on your LabVIEW.ini file:
    1. hit <enter>
    2. click anywhere on the FP to remove focus from the string indicator

See the pictures below

 

check.PNGOption.PNG


"Should be" isn't "Is" -Jay
Message 3 of 5
(2,500 Views)

Thank you both as I learned from both replies. (They came a lot quicker than expected too.)

 

It would work if I just entered the string and then hit run. The CRLF was definitely the problem. I forgot that the enter keys were different. Well I forgot about the check mark too. 

 

Shoulda got busy right after class but work was too hectic.

 

BTW, is there a way to trim off carriage returns, etc on strings coming in from a device? 

 

Thanks again,

 

jh 

0 Kudos
Message 4 of 5
(2,492 Views)
Solution
Accepted by topic author jvh75021

Hi jhv,

 

there is a function "Trim whitespaces" in the string functions palette...

Best regards,
GerdW


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