Jump to content

Comparing Strings


Chellynne Bailey
 Share

You are about to reply to a thread that has been inactive for 2165 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm working with HTTP_Requests and responses to a PHP page.

In my LSL script, I'm comparing a bit of recieved data against a bit of stored data: 

if (a != b) llOwnerSay("Doesn't Match. We should have gotten " + a + " but we got " +b);

if (a== b) llOwnerSay("Data Matches");

Buttt when I run it, this happens:

Object: Doesn't Match. We should have gotten 929d44b65cdbba05af03b0c0b0ea4dc5 but we got 929d44b65cdbba05af03b0c0b0ea4dc5

If you notice, those strings are identical. But lsl says they are different. I've tried putting them both through llToLower and llEscapeURL, but they still don't come up as equal. Is there some sort of encoding issue I need to tackle to make this work?

 

 

Link to comment
Share on other sites

1 hour ago, Innula Zenovka said:

In case it is a non-printing character, then strTest = llStringTrim(strTest,STRING_TRIM) should get rid of those (you probably know this anyway, but others reading this thread in future might not).

Yes. Also, it's useful when printing arbitrary strings for debug purposes to enclose them in quote marks.

If it came in from the web, there are lots of other things that can go wrong. Strings that aren't UTF-8. Malformed UTF-8. Line breaks which are CR LF. Anything that comes in from the web must be sanitized before use.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2165 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...