Answers for "how to convert string into char array in JS"

5

string to char array in javascript

const string = 'hi there';

const usingSplit = string.split('');              
const usingSpread = [...string];
const usingArrayFrom = Array.from(string);
const usingObjectAssign = Object.assign([], string);

// Result
// [ 'h', 'i', ' ', 't', 'h', 'e', 'r', 'e' ]
Posted by: Guest on October-25-2020
0

change string to char array

String myString = "Hello, world!";
char[] myCharArray = myString.toCharArray();
Posted by: Guest on May-13-2021

Code answers related to "how to convert string into char array in JS"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language