小编Nan*_*ana的帖子

R中的Gsub函数

我有以下句子:

trying <- 'Happy CNY to You <-U+2661> Abundance BLESSING to you and your family! <-U+2661> happy and blessed year ahead! '
Run Code Online (Sandbox Code Playgroud)

我想删除<.....>这句话中的所有实体.我使用了以下功能:

comment = gsub(pattern = "<.*>", replacement = "", x= trying)
Run Code Online (Sandbox Code Playgroud)

但是,我被退回:

"Happy CNY to You happy and blessed year ahead! "
Run Code Online (Sandbox Code Playgroud)

我可以知道如何编辑代码,以便我有以下内容:

"Happy CNY to You Abundance BLESSING to you and your family! happy and blessed year ahead! "
Run Code Online (Sandbox Code Playgroud)

r gsub

2
推荐指数
1
解决办法
465
查看次数

Java String to Array Splitting

我有一个字符串,例如: "My brother, John, is a handsome man."

我想将其拆分为一个数组,使输出为:

"My" , "brother", "," , "John", "," , "is", "a", "handsome", "man", "."
Run Code Online (Sandbox Code Playgroud)

谁能帮我这个?我需要在Java上执行此操作.

java split

1
推荐指数
1
解决办法
102
查看次数

标签 统计

gsub ×1

java ×1

r ×1

split ×1