Is the “Contains” Delphi string helper case sensitive?

柔情痞子 提交于 2019-12-07 11:59:08

问题


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


回答1:


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));


来源:https://stackoverflow.com/questions/30180634/is-the-contains-delphi-string-helper-case-sensitive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!