2016-09-30 63 views
1

我在Inno Setup的以下功能:Inno Setup的類型不匹配時,分配函數的返回值的字符串

function GetSerialNumber(ADelimiter: Char): string; 
var 
    I: Integer; 
begin 
    Result := ''; 
    for I := 0 to GetArrayLength(SerialEdits) - 1 do 
    Result := Result + SerialEdits[I].Text + ADelimiter; 
    if GetArrayLength(SerialEdits) > 1 then 
    begin 
    Delete(Result, Length(Result), 1); 
    end 
end; 

在下面的另一個功能,我有一個名爲Serial: string變量,但是當我做

Serial := GetSerialNumber(''); 

我得到一個類型不匹配的錯誤,有誰知道我做錯了什麼?謝謝!

回答

4

問題不是返回值,而是參數。

''不是有效的char字面值。 A文字必須只有一個字符長。 ''string

如果要允許空分隔符,請將參數類型更改爲string

相關問題