该函数的原型为:
语法: function StringChange(var S: String; const FromStr, ToStr: String): Integer;
描述: This function is deprecated. It is equivalent to calling
StringChangeEx with the SupportMBCS parameter set to False.
此函数已弃用。它等效于调用 SupportMBCS 参数设置为 False 的 StringChangeEx 函数。
经测试,可以在 Inno Setup 中使用,但是由于它返回的是 Integer 数值,故需要以下方法调用:
s := 'C:\Program Files\Inno Setup 5';
s1 := '\';
s2 := '/';
i := StringChange(s,s1,s2);
msgbox(IntToStr(i),mbConfirmation, MB_OK);
//显示 2msgbox(s ,mbConfirmation, MB_OK);
//显示 C:/Program Files/Inno Setup 5msgbox(s1 ,mbConfirmation, MB_OK);
//显示 \msgbox(s2 ,mbConfirmation, MB_OK);
//显示 /你把 StringChange 返回的 Integer 数值作为 String 使用,当然错误。
Inno Setup 帮助中,有的地方使用了下列语法,其实是错误的。
function StringChange(S: String; Const FromStr, ToStr: String): String;