Skip to main content

match_case

Matches the casing of the first string to the casing of the second string, returning the first string in either all uppercase or all lowercase.

def match_case(
s: string,
other: string
) - > string

Adjusts the casing of a string to match the casing of another reference string.

Parameters​

NameTypeDescription
sstringThe target string that will have its casing modified.
otherstringThe reference string used to determine whether the target string should be uppercase or lowercase.

Returns​

TypeDescription
stringThe input string converted to uppercase if the reference string is uppercase, otherwise converted to lowercase.