WMLScript removeAt() 函数
removeAt() 函数把字符串划分为元素,并删除指定的元素。
语法
n = String.removeAt(string, index, separator)
成分 | 描述 |
---|---|
n | 从函数返回的字符串。 |
string | 原始字符串。 |
index | 要删除的元素的下标。 |
separator | 分隔符。 |
例子
var a = String.removeAt("Visit W3Schools!",0," "); var b = String.removeAt("Visit W3Schools!",0,"W"); var c = String.removeAt("Visit W3Schools!",-2," "); var d = String.removeAt("Visit W3Schools!",10," ");
结果
a = "W3Schools!" b = "3School!" c = "W3Schools!" d = "Visit"