How to split a string into words. Ex: “stringintow

2019-01-07 05:37发布

What is the right way to split a string into words ? (string doesn't contain any spaces or punctuation marks)

For example: "stringintowords" -> "String Into Words"

Could you please advise what algorithm should be used here ?

! Update: For those who think this question is just for curiosity. This algorithm could be used to camеlcase domain names ("sportandfishing .com" -> "SportAndFishing .com") and this algo is currently used by aboutus dot org to do this conversion dynamically.

13条回答
Deceive 欺骗
2楼-- · 2019-01-07 06:32

The only way that you could split that string into words is to use a dictionary. Although this would probably be quite resource intensive.

查看更多
登录 后发表回答