Splite javascript

Esempi di codice

33
0

javascript esplodere

//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
28
0

N

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']
*
*/
20
0

N

// bad example https://stackoverflow.com/questions/6484670/how-do-i-split-a-string-into-an-array-of-characters/38901550#38901550

var arr = foo.split(''); 
console.log(arr); // ["s", "o", "m", "e", "s", "t", "r", "i", "n", "g"]
3
0

stringa in un array javascript

// If you want to split on a specific character in a string:
const stringToSplit = '01-02-2020';
console.log(stringToSplit.split('-')); 
// ["01", "02", "2020"]

// If you want to split every character:
const stringToSplit = '01-02-2020';
console.log(Array.from(stringToSplit));
// ["0", "1", "-", "0", "2", "-", "2", "0", "2", "0"]
2
0

N

var str = "12,15,16,78,59";
var res = str.split(",");
console.log(res[0]); // result: 12
console.log(res[2]); // result: 16
1
0

N

// It essentially SPLITS the sentence inserted in the required argument
// into an array of words that make up the sentence.

var input = "How are you doing today?";
var result = input.split(" "); // Code piece by ZioTino

// the following code would return as
// string["How", "are", "you", "doing", "todaY"];
0
0

N

strName.split(); // My code

Pagine correlate

Pagine di esempio simili

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
English
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................