I suggest add Mindaugas posting to documentation of upcoming function
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Szakáts Viktor Sent: Thursday, June 12, 2008 10:00 AM To: Harbour Project Main Developer List. Subject: Re: [Harbour] 2008-06-07 13:26 UTC+0100 Viktor Szakats (harbour.01syenar hu) Thanks Mingaugas, I was expecting exactly this kind of input. So this is not a clone of sprintf(), but rather something similar but specially crafted for SQL expressions. I'll rename current C_SPRINTF() to SQL_SPRINTF(), and we can later plug additional implementations with different names. Actually we have StrFormat() in hbmisc already, which might be extended with the functionality your describe. It currently supports %1, %2, ..., %9, and accepts strings only. I'll commit some cleanups for it ASAP. I'd stick with a simpler name for such a (non-sprintf compatible) function, HB_STRFORMAT() comes to mind. Brgds, Viktor On 2008.06.12., at 9:36, Mindaugas Kavaliauskas wrote: > Javier wrote: >> I think that the better name for the function would be Sprintf() >> but I believe that it is not my decision. > > Szakáts Viktor wrote: > > As for a name I'd suggest LIBC_SPRINTF() or C_SPRINTF(), > > maybe HB_SPRINTF() as alternatives. > > > > Votes, suggestions and opinions are welcome. > > > Hi, > > > for HB_Sprintf() I think we must implement a C compatible sprintf() > but add a type specifier for printing typeless data. This new > specifier should print data of all types: string, numeric, date > (respecting _SET_DATE format), etc. > New flags worth to be implemented can be: > 1) string and numbers trimming (it would be usefull because .dbf > fields are space PADR'ed); > 2) some 'plain portable format' flag for printing date; > time in '20080612' instead of _SET_DATE '12/06/08'. If we find a way > to specify a full date formating, I see it also usefull, example: > %'YYYY-MM-DD hh:mm:ss.ttt't. > > Your current _SPD() implementation is very similar. You use %t the > similar way I've mentioned specifier for typeless data, but it's SQL > oriented. I would expect > HB_Sprintf("%t %t", "It's number", 5.5) => "It's number 5.5" > but current code works > _SPD("%t %t", "It's number", 5.5) => "'It''s number' 5.5" > > I think your code is more SQL_Sprintf(), than HB_Sprintf(). > > > Best regards, > Mindaugas > _______________________________________________ > Harbour mailing list > [email protected] > http://lists.harbour-project.org/mailman/listinfo/harbour _______________________________________________ Harbour mailing list [email protected] http://lists.harbour-project.org/mailman/listinfo/harbour _______________________________________________ Harbour mailing list [email protected] http://lists.harbour-project.org/mailman/listinfo/harbour
