add Ox.splice
This commit is contained in:
parent
037685e738
commit
5c2842e0d4
1 changed files with 11 additions and 0 deletions
|
@ -407,6 +407,17 @@ Ox.repeat = function(value, times) {
|
|||
return ret;
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.splice <f> <code>[].splice</code> for strings, returns a new string
|
||||
> Ox.splice('12xxxxx89', 2, 5, 3, 4, 5, 6, 7)
|
||||
'123456789'
|
||||
@*/
|
||||
Ox.splice = function(string, index, remove) {
|
||||
var array = string.split('');
|
||||
Array.prototype.splice.apply(array, Ox.slice(arguments, 1));
|
||||
return array.join('');
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.startsWith <f> Checks if a string starts with a given substring
|
||||
If the substring is a string literal (and not a variable),
|
||||
|
|
Loading…
Reference in a new issue