Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Support for .NET String.Format() string output
Message
From
19/06/2005 23:14:50
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
General information
Forum:
Visual FoxPro
Category:
VFPX/Sedna
Miscellaneous
Thread ID:
01024701
Message ID:
01024743
Views:
21
Sergey,

>>What it does that cannot be done easily in FoxPro?

How many lines of code am I allowed? ;-)
function stringdotformat(lcString,lxArg0,lxArg1,lxArg2,lxArg3)
return Textmerge(strtran(m.lcstring,[{],[{m.lxArg]),.f.,[{],[}])
Not perfect- in the C# version you can use {{ and }} to include non-placeholder squiggly brackets in the format string.

So:
function stringdotformat(lcString,lxArg0,lxArg1,lxArg2,lxArg3)
lcstring=strtran(m.lcstring,[{{],chr(1))
lcstring=strtran(m.lcstring,[}}],chr(2))
lcstring=Textmerge(strtran(m.lcstring,[{],[{m.lxArg]),.f.,[{],[}])
return chrtran(m.lcstring,chr(1)+chr(2),[{}])
or even
function stringdotformat(lcString,lxArg0,lxArg1,lxArg2,lxArg3)
return chrtran(Textmerge(strtran(strtran(strtran(m.lcstring,[{{],chr(1)),[}}],chr(2)),[{],[{m.lxArg]),.f.,[{],[}]),chr(1)+chr(2),[{}])
Regards

j.R
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform