Problem with Index specifiers in format function

Hi,

working for 64-bit, but for 32-bit facing the same issue.

Hi,

what exactly case doesn’t work for you in 32-bit mode?

Only the first two are working fine for me in 32-bit…
format(%s) and format(%0:s)

Hi,

try to retest with Delphi 11 update 3 (version 28.0.48361.3236)

Hi,
I have tried with "Delphi 11 Version 28.0.48361.3236 " . The result was same. Working for 64-bit and 32-bit not working

Hi,

I’ve attached project with 32-bit executable and .dcu : testcase.7z (1.6 MB)

test my executable and try to use my .dcu for compiling this project.

I could view the results using your executable and.dcu files. When I ran and compiled the same project, an error message appeared.

Hi,

make sure that you are using 997e3e8 commit:

no result

Hi,

I’m using 997e3e8 commit locally.

as you can see, it works correctly …


Check your paths - you may use PascalScript from other source …

try to copy pascal script sources from GitHub - remobjects/pascalscript: pascalscript into folder with testcase and retest

Hi,

Thanks for the support. It worked with that commit.

1 Like

Hi Team,
I apologize for reopening this thread. I want to mention a format-related concern once more.
The format method is returning “Invalid class typecast” to me.

Eample:
“s := format(‘’%s %s %s ins’‘,[’‘one’‘,’‘two’‘,’‘three’‘]);’”.

The “invalid type cast” problem occurs when we use three parameters.
It functions as intended when we have more or fewer than three parameters.

Would you kindly assist me with this? Attached sample test case. I’m using 997e3e8 commit.
Sample.pas (3.1 KB)

Hi,

update to 61aeb99 commit.

P.S. with this fix, you can simplify MyFormat method to

function MyFormat(const Format: AnsiString; const Args: array of const): AnsiString;
begin
  result := System.AnsiStrings.Format(Format, Args);
end;

With this 997e3e8 commit , the following was not working
{
format(‘’%s %s %s ‘’,[‘‘one’’,‘‘two’’,‘‘three’’]);
}

and with this 61aeb99 commit the following are not working
{
’ s := s + #13#10+ format(‘’%0:s ins’‘,[’‘tes’‘]);’ +
’ s := s + #13#10+ format(‘’%0:s %1.2f ins’‘,[’‘tes’‘, 124578.12]);’ +
’ s := s + #13#10+ format(‘’%1.2f’‘,[124578.12]);’ +
’ s := s + #13#10+ format(‘’%1.2m’‘,[124578.12]);’ +
’ s := s + #13#10+ format(‘’%1.2m %s ing’‘,[124578.12, ‘‘test’’]);’ +
’ s := s + #13#10+ format(‘’ %s “@%s”‘’,[‘‘124578.12’’, ‘‘test’’]);’ +
}

attaching sample code
Sample.pas (3.8 KB)

Hi,

retest with 4e7be47