WMLScript replaceAt() 関数
replaceAt() 関数は文字列を要素に分割し、指定された要素を置き換えます。
文法
n = String.replaceAt(string, substring, index, separator)
成分 | 説明 |
---|---|
n | 関数から返される文字列。 |
string | 元の文字列。 |
substring | 指定された要素を文字列で置き換える。 |
index | 文字列をどこで置き換えるかを指定する整数。 |
separator | 区切り文字。 |
例
var a = String.replaceAt("Visit CodeW3C.com!","I love",0," "); var b = String.replaceAt("Visit CodeW3C.com!","us!",2," ");
結果
a = "I love CodeW3C.com!" b = "Visit us!"