jai-like CTFE string formating

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 12 07:15:02 PDT 2017


On Saturday, 12 August 2017 at 13:19:12 UTC, ixid wrote:
> On Saturday, 12 August 2017 at 11:47:10 UTC, Stefan Koch wrote:
>> Whereas the following alternative takes 20 ms :
>> {
>>     import ctfe_utils;
>>     pragma(msg, format_jai("Hello % % % % % % % % %", " I ", " 
>> just", " have" , " to", " concat", " a lot", " of", " strings 
>> ...", 9));
>> }
>>
>> see for yourself:
>> https://www.youtube.com/watch?v=T0BJxdt61RY
>
> Could we not improve the syntax to something like:
>
>      pragma(msg, format_jai("Hello %9", " I ", "
>  just", " have" , " to", " concat", " a lot", " of", " strings
>  ..."));
>  }
>
> Or whatever is closest that doesn't step on the current print 
> syntax.

The point of format is that you want to replace the % my the 
argument and then write more static text.

"The Parameter '%' was null and it should not be"
"Rule '%' was not found in catalog '%' is possible the closest 
match"



More information about the Digitalmars-d mailing list