It can replace a word in a string by passing the position of the word determinded with StringGetPos. Have a look:
StringReplaceWord(In_String,In_StartWordPos,In_WordLength,In_ReplaceText) { ; In_String : InputVar ; In_StartWordPos : Position of substring that will be replaced (determined with StringGetPos) ; In_WordLength : Number of chars the substring consists of ; In_ReplaceText : substring will be replaced with this text local Length, Before, After, Ret_Val StringLen, Length, In_String If (In_StartWordPos>Length)OR(In_StartWordPos+In_WordLength>Length)OR(Length=0) return, %In_String% StringLeft, Before, In_String, In_StartWordPos StringRight, After, In_String, Length-(In_StartWordPos+In_WordLength) Ret_Val=%Before%%In_ReplaceText%%After% return, %Ret_Val% }
Here's a short code snippet to demonstrate how to use it.
var = AGU is stupid StringGetPos, pos, var, stupid result := StringReplaceWord(var, pos, 6, "so brilliant") MsgBox, Original:`t`t%var%`n`nAfter Function:`t%result%
____________
Regards
AGU a.k.a AGermanUser