Inserts a string within another string
#include <String.au3>
_StringInsert ( $sString, $sInsertion, $iPosition )
$sString | Original string |
$sInsertion | String to be inserted |
$iPosition | Position to insert the insertion string (negatives values will insert from the right hand side) |
Success: | a new modified string. |
Failure: | the original string and sets the @error flag to non-zero. |
@error: | 1 - Invalid position |
Use negative position values to insert the string from the right hand side.
#include <MsgBoxConstants.au3>
#include <String.au3>
Example()
Func Example()
; Variable to store the output
Local $sOutput = ""
; Inserts three "moving" underscores and prints them to the console.
For $i = -20 To 20
$sOutput &= $i & @TAB & _StringInsert("Supercalifragilistic", "___", $i) & @CRLF
Next
; Display the output
MsgBox($MB_SYSTEMMODAL, "", $sOutput)
EndFunc ;==>Example