Compare two strings with contains function

0
I am trying to verify if two strings are equal with the contains function but I am not achieving the desired result. Is there another way to compare two strings? (I already tried the trim and tolower functions)    
asked
1 answers
2

Hi Nicole Baptista,

        If you convert the $Variable string to UTF-16 or ASCII character, you will find out the difference between non-breaking spaces and normal spaces. Non-breaking spaces are not considered Space. So If we use trim() or replaceAll() function,
         It will not work. You need to manually replace these non-breaking spaces with normal spaces and then apply replaceAll($Variable,' ','') to remove all the spaces in that string. For your reference, I will share the ASCII converter and UTF-16 converter links to verify, whether $Variable has non-breaking spaces or not. horizontal space (\u00a0) is one of the non-breaking space. Just check this one.

https://convertcodes.com/utf16-encode-decode-convert-string/

https://onlinestringtools.com/convert-string-to-ascii

White space character table doc link :    https://en.wikipedia.org/wiki/Whitespace_character

If it's there, just replaces this \u00a0 with normal space.
I hope it will solve your issue!

 

https://stackoverflow.com/questions/28295504/how-to-trim-no-break-space-in-java

 

Thanks and regards,

Vijayabharathi V

answered