R编程中将字符串从小写转换为大写——toupper()函数
R 编程中的toupper()
方法用于将小写字符串转换为大写字符串。
Syntax: toupper(s)
Return: Returns the uppercase string.
示例 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"