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

前端 未结 13 1230
粉色の甜心
粉色の甜心 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:40

    Best bet would be to compare a substring from 0 with a dictionary, and when you found a match, to extract that word and start a new dictionary search from that point... but it's going to be very error prone, and you'll have issues with plurals and apostrophes (sinks, sink's), and other parts of speech.

    EDIT

    would "singleemotion" become "single emotion" or "sin glee motion"?

提交回复
热议问题