Inno Setup是否有一些通配符?我正在尝试遍历字符串,如果要搜索某个值,程序应返回1(我正在使用Pos()
函数,该函数已经满足了我的需要),但是我的问题是我要搜索的字符串部分不是静态的,因此我需要一些*
之类的通配符,可以替换一个或多个字符。
答案 0 :(得分:1)
Inno Setup Pascal脚本中没有模式匹配功能。
但是您可以使用如下函数:
function AnythingAfterPrefix(S: string; Prefix: string): Boolean;
begin
Result :=
(Copy(S, 1, Length(Prefix)) = Prefix) and
(Length(S) > Length(Prefix));
end;
并像这样使用它:
if AnythingAfterPrefix(S, 'Listing connections...') then
您可能想添加TrimRight
来忽略尾随空格:
if AnythingAfterPrefix(TrimRight(S), 'Listing connections...') then
答案 1 :(得分:1)
根据documentation,现在有
function IsWildcard(const Pattern: String): Boolean;
function WildcardMatch(const Text, Pattern: String): Boolean;
也许它们是最近添加的。应该做你所需要的。