我有以下字符串:
dt< - "我觉得夜晚爆炸当我们在一起时情感过载在快乐的热度中带我到你的怀抱中永远不要让我离开我今晚真的需要知道告诉我,告诉我,我是唯一的一个这真的是爱还是只是一个游戏告诉我的内心我能感受到我的身体摇滚每当你打电话给我的名字时,激情就如此完整它&永远不会结束只要我收到这条消息,你就会把身体送到身体,灵魂送到灵魂总是觉得你在附近所以说出我渴望听到的话告诉我,我告诉我唯一的一个真的是爱还是只是一个游戏告诉我的心情我能感受到我的身体摇滚每次你叫我的名字爱...奔跑的爱打破我们虽然我们一直坚持我不要想要失去没有...我不能让你走了...告诉我,我告诉我,我是唯一的一个这真的是爱还是只是一场游戏告诉我的心情我能感受到我的身体摇滚每次你叫我的名字告诉我的心告诉我星星告诉我的心告诉我的心告诉我星星告诉我的心告诉我的心永远不要停止哦把它带到心里哦不不啊啊告诉我的心告诉我我是只有一个这真的是爱还是只是一个游戏告诉我的心我每次打电话给我的身体时都能感受到我的身体摇滚#34;
我试过了 unlist(strsplit(dt,split =" [[:upper:]]"))
但它取出大写字母。
我想拆分它,以便每个字符串以大写字母开头。例如,
"我觉得夜晚爆炸",
"当我们在一起",
"情绪超载"等
有没有办法像这样拆分?谢谢!
答案 0 :(得分:2)
你需要使用“lookarounds”
x <- "I feel the night explode When we're together Emotion overload In the heat of pleasure Take me I'm yours into your arms Never let me go Tonight I really need to know Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name The passion's so complete It's never ending As long as I receive This message you're sending Body to body, soul to soul Always feel you near So say the words I long to hear Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name Love...love on the run Breaking us down Though we keep holding on I don't want to lose No...I can't let you go... Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name Tell it to my heart Tell me from the stars Tell it to my heart Tell it to my heart Tell me from the stars Tell it to my heart Never make it stop Oh take it to the heart Oh no no ah ah Tell it to my heart Tell me I'm the only one Is this really love or just a game Tell it to my heart I can feel my body rock Every time you call my name"
v <- unlist(strsplit(x, split = "(?=\\s[A-Z])", perl=TRUE))
v <- v[v!=" "]
head(v)
# [1] "I feel the night explode" "When we're together"
# [3] "Emotion overload" "In the heat of pleasure"
# [5] "Take me" "I'm yours into your arms"
答案 1 :(得分:2)
// If you don't specify a class to implement, Dagger will write one.
// This might be useful if you only have one implementation, but you
// want to substitute it with a mock in tests.
@AutoFactory(implementing = SourceOfCoolWaterFactory.class)
public WaterCooler(Water water, @Provided Electricity electricity) {
// ...
}