メインコンテンツまでスキップ
バージョン: 開発中

Insert string

Insert string ( source ; what ; where ) -> 戻り値

引数説明
source文字🡒文字列を挿入する文字列
what文字🡒挿入する文字列
where倍長整数🡒挿入する位置
戻り値文字🡐結果の文字列

説明

Insert stringは、sourcewhereで指定された位置の前に、whatを 挿入した文字列を返します。

whatが空の文字列("") であれば、Insert stringはsourceを変更しないで返します。

whereが、sourceの長さよりも大きい場合は、whatsourceの後ろに追加します。whereが1よりも小さい場合には、whatsourceの前に挿入します。

Insert stringは、文字を上書きしないで挿入するという点がChange stringと異なります。

例題

Insert string関数の使用例を次に示します。結果を変数vtResultに代入します。

 vtResult:=Insert string("The tree";" green";4) // vtResultは"The green tree"
 vtResult:=Insert string("Shut";"o";3) // vtResultは"Shout"
 vtResult:=Insert string("Indention";"ta";6) // vtResultは"Indentation"

参照

Change string
Delete string
Replace string