Change string
Change string ( source ; newChars ; where ) -> 戻り値
引数 | 型 | 説明 | |
---|---|---|---|
source | 文字 | 🡒 | 元の文字列 |
newChars | 文字 | 🡒 | 新しい文字 |
where | 倍長整数 | 🡒 | 入れ替え開始位置 |
戻り値 | 文字 | 🡐 | 結果の文字列 |
説明
Change stringは、sourceの中の文字グループを修正したものを返します。whereで指定された位置から、newCharsでsourceを上書きします。
newCharsが空の文字列("")の場合、Change stringはsourceを変更しないで返します。Change stringは常にsourceと同じ長さの文字列を返します。whereがsourceの長さ以下の場合やsourceの長さ以上の場合、Change stringはsourceを返します。
Change stringは、文字を挿入しないで上書きするという点がInsert stringと異なります。
例題
Change stringの使用例を次に示します。結果を変数vtResultに代入 します。
vtResult:=Change string("Acme";"CME";2) // vtResultは"ACME"
vtResult:=Change string("November";"Dec";1) // vtResultは"December"