Henry Olive 5 Posted December 21, 2021 I wish everyone a healthy day. Uses System.StrUtils; var S, FirstStr, SecStr : String, begin S := SqlQuery1.FieldByName ('RANGE').asString; // it is '5/10' FirstStr := SplitString(S, '/')[0]; SecStr := SplitString(S, '/')[1]; end; Above code works in Delphi-XE w/o any problem but i get Not enough actual parameters err.msg in Delphi 10.3 What is wrong ? Thank You Share this post Link to post
Alexander Elagin 143 Posted December 21, 2021 I do not get any error here in 10.3: uses Types, StrUtils; var S, FS, SS: String; A: TStringDynArray; begin S := '5/10'; A := SplitString(S, '/'); if Length(A) >= 2 then begin FS := A[0]; SS := A[1]; end; end; Share this post Link to post
PeterBelow 238 Posted December 21, 2021 1 hour ago, Henry Olive said: I wish everyone a healthy day. Uses System.StrUtils; var S, FirstStr, SecStr : String, begin S := SqlQuery1.FieldByName ('RANGE').asString; // it is '5/10' FirstStr := SplitString(S, '/')[0]; SecStr := SplitString(S, '/')[1]; end; Above code works in Delphi-XE w/o any problem but i get Not enough actual parameters err.msg in Delphi 10.3 What is wrong ? Thank You There is nothing wrong with the code you posted, other than the comma instead of semicolon after the "string" in the var section. Perhaps you have another SplitString function closer in scope than StrUtils.SplitString here. If you hover the mouse over SplitString, what does the code insight popup tell you where it's from? Share this post Link to post
Achim Kalwa 61 Posted December 21, 2021 (edited) 1 hour ago, Henry Olive said: Uses System.StrUtils; var S, FirstStr, SecStr : String, begin S := SqlQuery1.FieldByName ('RANGE').asString; // it is '5/10' FirstStr := SplitString(S, '/')[0]; SecStr := SplitString(S, '/')[1]; end; Above code works in Delphi-XE w/o any problem but i get Not enough actual parameters err.msg in Delphi 10.3 What is wrong ? In line #3 the list of variables must me terminated by a semicolon, not by a comma. Beside that your code works as expected (Delphi 11.0). And because you did not tell in which line the error occours I can only wild guess that there is some other "SplitString" function in reach with uses different parameters. Where do you land when doing a Ctrl+Click on "SplitString"? Edited December 21, 2021 by Achim Kalwa code formatting Share this post Link to post
Guest Posted December 21, 2021 42 minutes ago, Achim Kalwa said: semicolon, not by a comma Well spotted! My eyesight is not up to that any more. Share this post Link to post
Henry Olive 5 Posted December 22, 2021 Thank you so much Alexander, Peter, Achim, Dany I tested my code in 10.3 in a *new project* and noticed my code works, then I copied the new project's Uses ( Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Controls, Forms, Vcl.Dialogs, Vcl.StdCtrls, System.StrUtils; ) I returned to my main project and paste the uses here and delete old uses and my problem solved. Regarding the variable semicolon, in my original codes it is semicolon, comma is my wrong typo I'm very very sorry for misleading you. Share this post Link to post