Answers for "string to array"

12

javascript split by comma

<script>
var names = 'Harry,John,Clark,Peter,Rohn,Alice';
var nameArr = names.split(',');
console.log(nameArr);
 
// Accessing individual values
alert(nameArr[0]); // Outputs: Harry
alert(nameArr[1]); // Outputs: John
alert(nameArr[nameArr.length - 1]); // Outputs: Alice
 
var str = 'Hello World!';
var chars = str.split('');
console.log();
 
// Accessing individual values
alert(chars[0]); // Outputs: H
alert(chars[1]); // Outputs: e
alert(chars[chars.length - 1]); // Outputs: !
</script>
Posted by: Guest on March-31-2020
27

java string to char array

String str = "example";
char[] ch = str.toCharArray();
Posted by: Guest on March-05-2020
20

convert string to array js

// our string
let string = 'ABCDEFG';

// splits every letter in string into an item in our array
let newArray = string.split('');

console.log(newArray); // OUTPUTS: [ "A", "B", "C", "D", "E", "F", "G" ]
Posted by: Guest on October-23-2020
27

php explode

$colors  = "red,blue,green,orange";
$colorsArray = explode(",", $colors);
Posted by: Guest on June-14-2019
33

javascript explode

//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Posted by: Guest on June-14-2019
43

string split javascript

var myString = "An,array,in,a,string,separated,by,a,comma";
var myArray = myString.split(",");
/* 
*
*  myArray :
*  ['An', 'array', 'in', 'a', 'string', 'separated', 'by', 'a', 'comma']
*
*/
Posted by: Guest on October-27-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language