📜  从字符串中获取特定字符串 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:51.001000             🧑  作者: Mango

代码示例1
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];