04-08-2019 06:42 AM
Hallo, I need to check if a string variable contains a second string, case sensitive and not. Is there any Diadem/VBS function to do this?
Here an example of what I mean:
If StrContain("pressure","pres") Then
ChnName = "Pressure"
ChnUnit = "bar"
End If
Solved! Go to Solution.
04-08-2019 07:51 AM
Hi mattia_verona,
You can use the InStr() command to see if a matching string is somewhere inside the larger string. You can use the LCase() or UCase() commands to cast the larger string to lower or upper case to ignore case differences. If you just wanted to check if the larger string started with the right matching string, you could use the Left() command.
ChName = "MYpreSSuRE" If InStr(LCase(ChName), "pres") Then ChName = "Pressure" ChUnit = "bar" End If MsgBox ChName
Brad Turpin
DIAdem Product Support Engineer
National Instruments
04-09-2019 04:57 AM
Thank you!
Mattia