Answers for "convert string into an array"

27

java string to char array

String str = "example";
char[] ch = str.toCharArray();
Posted by: Guest on March-05-2020
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
2

word to char array javascript

var word = userInput[0];
  var l = word.split("");
  console.log(l);

//input abb
//op ['a','b','b']
Posted by: Guest on December-07-2020
1

how to change string to array in javascript

a=anyElement.all

// console.log(a)
Array.from(a).forEach(function (element){
    console.log(element)
})
Posted by: Guest on August-02-2020

Code answers related to "convert string into an array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language