05-07-2018 10:33 AM
Good afternoon,
I have a question about the comparition between 2 strings.
My VI write in a txt file a message to indicate the state of the test. If this state is unchange I don't want to write on this file that's why I test the message and the message write in the last line of the txt file to be sure they are not similar and write.
But the comparator tools I use don't give the expected solution.
Someone could explain me how compaire these 2 strings?
Thanks
Solved! Go to Solution.
05-07-2018 10:37 AM
@fxblabview wrote:
But the comparator tools I use don't give the expected solution.
05-07-2018 11:08 AM - edited 05-07-2018 11:08 AM
To detect successive duplicate messages, use a feedback node and compare current and previous.
05-07-2018 12:08 PM - edited 05-07-2018 12:20 PM
@fxblabview wrote:
Good afternoon,
I have a question about the comparition between 2 strings.
My VI write in a txt file a message to indicate the state of the test. If this state is unchange I don't want to write on this file that's why I test the message and the message write in the last line of the txt file to be sure they are not similar and write.
But the comparator tools I use don't give the expected solution.
Someone could explain me how compaire these 2 strings?
Thanks
You send the strings with CR as your EOL but your read is set to convert EOL. In Windows, EOL is CR + LF, so the changes the EOL and the strings no longer match. It's only a guess (but a good one) since you didn't supply real code, and the probes and stuff don't show the backslash codes.
05-07-2018 06:50 PM
Since you only really care about the "readable" string content perhaps you could use the Trim Whitespace node on both before comparing them?
05-08-2018 01:16 AM
Right the txt file replace my CR by an EOL. Thats why I should put a supplementary character on the reading to have complete sentence.
Thanks for your help.
05-08-2018 01:26 AM
It's a good solution to not be bored by these invisible types.
05-08-2018 01:32 AM - edited 05-08-2018 01:33 AM
05-08-2018 01:33 AM
Sorry Knight to my approximations about my first post on the forum.
My expected response was that the comparator tools give a false response when the 2 sentences tested were similar... and a true when they were different.
05-08-2018 01:36 AM
Hi fx,
My expected response was that the comparator tools give a false response when the 2 sentences tested were similar... and a true when they were different.
The "unequal?" comparison gives TRUE when the inputs are unequal (aka "not the same").
When you are talking about this "unequal?" comparison then your expectation was right. 😄