add Ox.splice

This commit is contained in:
rolux 2012-05-26 15:05:11 +02:00
parent 037685e738
commit 5c2842e0d4

View file

@ -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),