BTW. there is a bug in the function, this should be right:
Code:
StringInsert(In_String,In_Posi,In_Insert)
{
local Length, Before, After, Ret_Val
StringLen, Length, In_String
if (In_Posi>Length)or(length=0)or(In_Posi<0)or(In_Insert=)
return, In_String
StringLeft, Before, In_String, In_Posi
StringRight, After, In_String, Length-In_Posi
Ret_Val=%Before%%In_Insert%%After%
return Ret_Val
}
The return value has to be without %%.
If you also remove the condition that if the insert string is empty, because it is a trivial solution. And handle the other conditions fail save the function could look like this
Code:
StringInsert(In_String,In_Posi,In_Insert)
{
StringLen, Length, In_String
if ( In_Posi > Length )
return In_String . In_Insert
if ( Length = 0 or In_Posi < 0)
return In_Insert . In_String
StringLeft, Before, In_String, In_Posi
StringRight, After, In_String, Length-In_Posi
return Before . In_Insert . After
}