修改字符串的函数 [英] Function Modifying a Character String
本文介绍了修改字符串的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个将输入作为字符串(BLANK)并打印以下内容的函数:
I need a function that will take input as a character string (BLANK) and print out the following:
"Hello BLANK World"
ie,world( seven)打印出 Hello七个世界
i.e., world("seven") prints out "Hello seven World"
我对如何使用R中的字符串感到非常困惑。
I'm very confused on how to work with character strings in R.
推荐答案
或...
x <- "seven"
sprintf("Hello %s World", x)
换句话说,不需要 world
函数,这就是 sprintf
的功能。
In other words no need for a world
function as that's what sprintf
does.
这篇关于修改字符串的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文