Reputation: 597
For any domain name example for microsoft.com
or mainsoft.com
how do I divide it into two words?
say mico
and soft
, main
and soft
I am talking about any domains...like stackoverflow.com
it should be stack
, over
, and flow
How can this be done?
Upvotes: 1
Views: 977
Reputation: 145512
You might want to try one of the hyphenation libraries mentioned in this answer:
Wrapping a text using php, based on language
It splits up words on syllables, which is probably what you want. A dictionary approach would be more reliable I think, but has more dependencies.
Upvotes: 0
Reputation: 4207
I'd suggest searching the domain string against a list of known words, and then using the fine php string library to break it apart.
http://wordlist.sourceforge.net/ is one source of lists of words.
Upvotes: 1