Ejemplo 1: explotar en jquery
var result=$(row).split('|');
alert(result);
Ejemplo 2: javascript explotar
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Ejemplo 3: javascript de división de cadenas
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']
*
*/
Ejemplo 4: división de JavaScript
// 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"]
Ejemplo 5: cadena dividida de JavaScript
// Split string into an array of strings
const path = "/usr/home/chucknorris"
let result = path.split("https://foroayuda.es/")
console.log(result)
// result
// ["", "usr", "home", "chucknorris"]
let username = result[3]
console.log(username)
// username
// "chucknorris"
Ejemplo 6: split () javascript
let countWords = function(sentence){
return sentence.split(' ').length;
}
console.log(countWords('Type any sentence here'));
//result will be '4'(for words in the sentence)
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)