R语言 把字符串从小写转换为大写 – toupper()函数
R编程中的 toupper() 方法用于将小写的字符串转换为大写的字符串。
语法: toupper(s)
返回: 返回大写的字符串。
例子 1 :
# R program to convert string
# from lowercase to uppercase
# Given String
gfg <- "Geeks For Geeks"
# Using toupper() method
answer <- toupper(gfg)
print(answer)
输出:
[1] "GEEKS FOR GEEKS"
例2 :
# R program to convert string
# from lowercase to uppercase
# Given String
gfg <- "The quick brown fox jumps over the lazy dog"
# Using toupper() method
answer <- toupper(gfg)
print(answer)
输出:
[1] "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG"