Jump to content

Recommended Posts

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

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
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
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 by Achim Kalwa
code formatting

Share this post


Link to post
Guest
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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×