নিচের কোড পাইথনে কেস-ইনসেনসিটিভ স্ট্রিং তুলনার একটি উদাহরণ।
উদাহরণ
string1 = 'Star Wars'
string2 = 'star wars'
if string1.lower() == string2.lower():
print("The strings are case insensitive")
else:
print("The strings are not case insensitive")
আউটপুট
এই কোড নিচের আউটপুট দেবে:
The strings are case insensitive
বিকল্প পদ্ধতি: string1.casefold() == string2.casefold() (ইউনিকোডের জন্য ভালো), re.search(pattern, string, re.IGNORECASE)।