>From the Amibroker help file (See note 2):

The StrFormat function formats and returns a series of characters and values
in the result string.

If arguments follow the format string, the format string must contain
specifications that determine the output format for the arguments.

StrFormat and printf behave identically except that printf writes output to
the window, while StrFormat does not write anything to output window but
returns resulting string instead.

StrFormat function is useful with conjunction with fputs function that
allows to write string to a file.

Note 1: for numbers always use %f, %e or %g formatting, %d or %x will not
work because there are no integers in AFL.

Note 2: as of now only numbers and arrays can now be used. For arrays
'selected value' is used


On Tue, Apr 7, 2009 at 12:53 PM, Barry Scarborough
<[email protected]>wrote:

>   Yea I was doing that but that's waked. Tomasz said "StrFormat and printf
> behave identically except that printf writes output to the window, while
> StrFormat does not write anything to output window but returns resulting
> string instead." He sends us to the MS website for a description of the
> valid operators. He says the ones for integers don't work but never said
> string operators are not supported.
>
> printf in C allows constructing compound strings with various types of
> input. I tried the %s and %S in printf and that does not work either. Either
> I am not using the correct format operator or printf does not support string
> input.
>
> Is it really true that Ami's printf and strFormat cannot build compound
> strings with numerical and string input?
>
> Barry
>
> --- In [email protected] <amibroker%40yahoogroups.com>, Lal
> <kla...@...> wrote:
> >
> > Sorry, that was not precise!
> >
> > Try this:
> >
> > textC = "OrdC: "+ ", type = "+ S + ",price1="+ StrFormat("%0.3f", p);
> >
> >
> >
> >
> > ________________________________
> > From: Barry Scarborough <razzba...@...>
> > To: [email protected] <amibroker%40yahoogroups.com>
> > Sent: Tuesday, 7 April, 2009 15:04:36
> > Subject: [amibroker] strFormat - how to insert strings
> >
> >
> > I am trying to build a string using the following formula. StrFormat will
> not allow me to insert a string into the string. My C manual says us a %s
> but Ami does not allow that. I tried upper and lower case S. Neither work.
> What should I use?
> >
> > s = "MKT";
> > p = 1.235;
> > textC = StrFormat("OrdC: ,type= %s ,price1= %1.4f", s, p);
> > printf(textC) ;
> >
> > Thanks,
> > Barry
> >
>
>  
>

Reply via email to