开发者

String operation

开发者 https://www.devze.com 2023-01-05 08:31 出处:网络
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 let

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

精彩评论

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