1. Regular expression, use the IGNORECASE flag
>>> import re
>>> m = re.search('multi', 'A mUltiCased string', re.IGNORECASE)
>>> bool(m)
2.
converts two strings to the same uppercase before comparing, using upper() or lowercase,lower()
>>> s = 'A mUltiCased string'.lower()
>>> s
'a multicased string'
>>> s.find('multi')
2
p>
div>
Read More:
- Python switch / case statement implementation method
- On the intern () method of string class in Java
- The differences between the equals method in the string class and the equals method in the object class
- Translate() and maketrans() methods of string in Python
- Implementation of Python switch / case statements
- The method of getting shell command output in Python
- A repeated string is composed of two identical strings. For example, abcabc is a repeated string with length of 6, while abcba does not have a duplicate string. Given any string, please help Xiaoqiang find the longest repeated substring.
- 26 English letters in upper and lower case and 0-9 to generate 8-bit random password
- Error handling method of “no module named ‘stringio’” in Python 3
- Difference between isempty method and isblank method in stringutils
- Python: How to Fix “Ord() expected string of length 1, but int found”
- Unity short string intercepts long string
- Typeerror: write() argument must be STR, not bytes and the method of writing binary file in Python 3
- Typeerror: write() argument must be STR, not bytes and the method of writing binary file in Python 3
- Python string prefix
- Python conversion hex to string, high and low data processing
- N: Ignoring file ’50unattended-upgrades.ucf-dist’ in directory ‘/etc/apt/apt.conf.d/’ as it has an i
- TSLint:object access via string literals is disallowedtslint(no-string-literal)
- Python TypeError: not all arguments converted during string formatting [Solved]