Answers for "javascript get string up to first space"

1

split string with the first space occurs JavaScript

var str="72 tocirah sneab";
str.substring(0, str.indexOf(' ')); // "72"
str.substring(str.indexOf(' ') + 1); // "tocirah sneab"
Posted by: Guest on March-16-2022
1

js get first space in string

str.match(/^(\S+)\s(.*)/).slice(1)
Posted by: Guest on April-16-2021

Code answers related to "javascript get string up to first space"

Code answers related to "Javascript"

Browse Popular Code Answers by Language