[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: strFormat - how to insert strings



PureBytes Links

Trading Reference Links

Thanks Tony. 

I guess I read more into it than what is stated since a string in C is an array, just not an "ALF" array. Still, it boggles my mind that strFormat will not take a string as one of the arguments. It is really sloppy to have to concatenate strings with strFormatted numbers to produce a whole string when StrFormat could have accomplished that so easily. I will go back to what works, as cumbersome as that may be.

Barry

--- In amibroker@xxxxxxxxxxxxxxx, Tony Grimes <Tonez.Email@xxx> wrote:
>
> 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
> <razzbarry@xxx>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 amibroker@xxxxxxxxxxxxxxx <amibroker%40yahoogroups.com>, Lal
> > <klal25@> wrote:
> > >
> > > Sorry, that was not precise!
> > >
> > > Try this:
> > >
> > > textC = "OrdC: "+ ", type = "+ S + ",price1="+ StrFormat("%0.3f", p);
> > >
> > >
> > >
> > >
> > > ________________________________
> > > From: Barry Scarborough <razzbarry@>
> > > To: amibroker@xxxxxxxxxxxxxxx <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
> > >
> >
> >  
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/