Pixel-Composer/scripts/string_splice/string_splice.gml

28 lines
545 B
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
function string_splice(str, delim) {
var st = [];
var ss = str;
var sp;
2023-06-01 10:32:21 +02:00
var wd = string_length(delim);
2022-01-13 05:24:03 +01:00
do {
sp = string_pos(delim, ss);
2023-01-04 02:30:04 +01:00
if(sp == 0) { //no delim left
array_push(st, ss);
break;
2022-01-13 05:24:03 +01:00
} else {
var _ss = string_copy(ss, 1, sp - 1);
2023-01-04 02:30:04 +01:00
array_push(st, _ss);
2022-01-13 05:24:03 +01:00
}
ss = string_copy(ss, sp + 1, string_length(ss) - sp);
} until(sp == 0);
return st;
2022-11-18 03:20:31 +01:00
}
function string_title(str) {
var ch = string_char_at(str, 1);
ch = string_upper(ch);
var rs = string_copy(str, 2, string_length(str) - 1);
return ch + rs;
2022-01-13 05:24:03 +01:00
}