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

Re: [amibroker] Re: strFormat - how to insert strings



PureBytes Links

Trading Reference Links

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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___