在 Julia 中将字符串转换为小写 – lowercase() 和 lowercasefirst() 方法
lowercase()
是 julia 中的内置函数,用于返回所有字符都转换为小写的字符串。
Syntax: lowercase(s::AbstractString)
Parameters:
- s::AbstractString: Specified string.
Returns: It returns a string with all characters converted to lowercase.
例子:
# Julia program to illustrate
# the use of lowercase() method
# Getting a string with all
# characters converted to lowercase
println(lowercase("GFG"))
println(lowercase("GEEKS"))
println(lowercase("GEEKSFORGEEKS"))
输出:
gfg
geeks
geeksforgeeks
小写优先
lowercasefirst()
是 julia 中的内置函数,用于返回第一个字符转换为小写的字符串。
Syntax: lowercasefirst(s::AbstractString)
Parameters:
- s::AbstractString: Specified string.
Returns: It returns a string with first character converted to lowercase.
例子:
# Julia program to illustrate
# the use of lowercasefirst() method
# Getting a string with first
# character converted to lowercase
println(lowercasefirst("GFG"))
println(lowercasefirst("GEEKS"))
println(lowercasefirst("GEEKSFORGEEKS"))
输出: