Answers for "string.split"

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
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
44

How to split a string in Java

String string = "004-034556";
String[] parts = string.split("-");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
Posted by: Guest on February-01-2020
46

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
3

how consider the first caracter in Split c#

Considerar somente a primeira string especificada para realizar o split
You can specify how many substrings to return using string.Split:

string myString = "101.a.b.c.d"

var pieces = myString.Split(new[] { '.' }, 2);
Returns:

101
a.b.c.d
Posted by: Guest on April-28-2020
14

string to array javascript

const str = 'Hello!';

console.log(Array.from(str)); //  ["H", "e", "l", "l", "o", "!"]
Posted by: Guest on April-29-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language