I need to insert a space after every character of a string.
i.e.
String name = \"Joe\";
should become: \"J o e\"
Solution without regex
name.chars().mapToObj(i -> (char) i + " ").collect(Collectors.joining()).strip()
Don't like regex because compile method slow
This will space out all letters in each word and not between words
"Joe Black".replaceAll("\\B", " ") -> "J o e B l a c k"
This will put space for each character (including original spaces)
"Joe Black".replaceAll("\\B|\\b", " ") -> " J o e B l a c k "
char[] stringArray = strOrig.toCharArray();
StringBuilder sb = new StringBuilder();
for(int index=0; index < stringArray.length; index++) {
sb.append(stringArray[index]);
sb.append(" ");
}