How to split a string into words. Ex: “stringintowords” -> “String Into Words”?

前端 未结 13 1206
粉色の甜心
粉色の甜心 2020-11-29 20:18

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 Word

13条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 20:26

    Create a list of possible words, sort it from long words to short words.

    Check if each entry in the list against the first part of the string. If it equals, remove this and append it at your sentence with a space. Repeat this.

提交回复
热议问题