PureBytes Links
Trading Reference Links
|
Hello,
It works exactly the same as format string in C-language 'printf'. You can find it
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_crt_format_specification_fields_.2d_.printf_and_wprintf_functions.asp
But with exceptions described in the user's guide (i.e. only floating point numbers are supported)
In the user's guide:
http://www.amibroker.com/f?strformat
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
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "s.carrasset" <s.carrasset@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, December 18, 2004 3:09 PM
Subject: Re: [amibroker] StrMid(NumToStr(1040928),4,3);
>
> Thanks,
>
> anyone knows where i can find a explanation for formatstr
> in *StrFormat( formatstr, ... )
>
> Stephane
>
>
> *
>
> Tomasz Janeczko a écrit :
>
>> Stephane,
>>
>> Why not just check what NumToStr returns before assuming bug ?
>>
>> StrMid operates on STRINGs. You can get same results if strings passed
>> are the same
>> in your case they are NOT. This is so because NumToStr by default
>> returns strings
>> with thousand separators.
>>
>> If you investigated a little bit more:
>>
>> string=NumToStr(1040928);
>> mm= StrMid(string,4,3);
>> test= StrMid("1040928",4,3);
>>
>> you would find that NumToStr(1040928)
>> gives you sting like this:
>> "1,040,928.000"
>>
>> As you can see there are thousands separators there.
>> Because "1,040,928.000" is different string than "1040928"
>> characters 4..6 are different too.
>>
>> If you want string without separators you have to specify this in your
>> NumToStr call http://www.amibroker.com/f?numtostr
>>
>> string=NumToStr(1040928,1,False);
>> mm= StrMid(string,4,3);
>> test= StrMid("1040928",4,3);
>>
>> You can use StrFormat for more control
>> http://www.amibroker.com/f?strformat
>>
>> string=StrFormat("%.9g",1040928);
>> mm= StrMid(string,4,3);
>> test= StrMid("1040928",4,3);
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|