Answers for "get specific string from string"

0

get specific string from string

var the_string = "sometext-20202";
var parts = the_string.split('-', 2);

// After calling split(), 'parts' is an array with two elements:
// parts[0] is 'sometext'
// parts[1] is '20202'

var the_text = parts[0];
var the_num  = parts[1];
Posted by: Guest on September-17-2021

Code answers related to "get specific string from string"

Browse Popular Code Answers by Language