Splitting a string in an indian language (non-english) to get each character

  javascript, node.js

If the string is in english, the following works:

"string".split('') // returns ['s', 't', 'r', 'i', 'n', 'g']

But what if the string is in some other language like hindi? .split('') will not work because:

"कमाल".split('') // returns ["क", "म", "ा", "ल"]

whereas I am interested in getting ["क", "मा", "ल"].

Is there a solution to this?

Source: Ask Javascript Questions

LEAVE A COMMENT