5

Delphi XE3 introduced a Contains string helper function, but the help-file/wiki does not state whether it is case sensitive or not?

5
  • From the help you are referring to: This function is case-sensitive. Commented May 12, 2015 at 5:01
  • 2
    @LU RD, I was sure that help page did not mention it when I've posted the question! Just to confirm if I was not mistaken, I've checked my TimeSnapper screenshots and yes, at 11:53 Sydney time the page did not mention the case-sensitivity :-) See imgur.com/ljMSt8m I see at the bottom of the mentioned help page "This page was last modified on 11 May 2015, at 19:40" so someone must have updated a short while ago :-) imgur.com/ny7NRM1 XE7 and earlier was not updated... docwiki.embarcadero.com/Libraries/XE7/en/… Commented May 12, 2015 at 5:30
  • 2
    User "Adap krw" has updated that page. Change history: docwiki.embarcadero.com/Libraries/XE8/e/… Commented May 12, 2015 at 5:35
  • Wow, someone is actually updating the docs, and seems to be reacting on SO posts :-) Commented May 12, 2015 at 5:48
  • Wow indeed, I was pretty surprised as well Commented May 12, 2015 at 5:51

1 Answer 1

4

Yes it is case sensitive.

Quick test:

ShowMessage('TEST'.Contains('t').ToString(TUseBoolStrs.True)); 

returns False


Use ToLowerInvariant or ToUpperInvariant to compare case insensitive:

ShowMessage('TEST'.ToLowerInvariant.Contains('t').ToString(TUseBoolStrs.True)); 
Sign up to request clarification or add additional context in comments.

1 Comment

Invariant casing is just one way. Perhaps locale sensitive would be needed for some applications.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.