Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

string to char array

const string = 'word';

// Option 1
string.split('');

// Option 2
[...string];

// Option 3
Array.from(string);

// Option 4
Object.assign([], string);

// Result:
// ['w', 'o', 'r', 'd']
Source by www.samanthaming.com #
 
PREVIOUS NEXT
Tagged: #string #char #array
ADD COMMENT
Topic
Name
4+2 =