String to individual characters

Sorry this is probably a newbie question, but I want to convert a String cell column into a series of new columns each containing only one character from that cell.  Is there an easy way to do this e.g. with the String Manipulation node?

Thanks in advance,

Alastair

Hi Alastair,

   I think the best option is creating a collection from the string and use the Split Collection Column node to create the columns.

   To do the first procedure I would use a Java Snippet node and depending on the expected input (like exotic -from the European perspective- languages might require codepoints instead of characters) create a String array with the characters in it and return it.

    The basic code would look like this (not tested):

char[] chs = input.toCharArray();
/*String[]*/ result = new String[chs.length];
for (int i = chs.length; i-->0;) {
   result[i] = new String(chs[i]);
}

Cheers, gabor

1 Like

Providing I am understanding correctly what about the Cell Splitter by position node