开发者

String operation

What's simplest way to turn the string "YingYang" into "Ying/Yang"? 开发者_StackOverflow中文版


Assuming you want to insert a slash everywhere where a lower case letter is followed by a capital letter:

"YingYang".gsub(/([a-z])([A-Z])/, '\1/\2')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜