[julia-users] Re: How to create own format with two digits 3=03, 10=10, 99=99 (only range 00:99)

2015-05-20 Thread Jeff Waller
how close is this to what you need? *[@sprintf("%02d",i) for i = 1:99]*

Re: [julia-users] Re: How to create own format with two digits 3=03, 10=10, 99=99 (only range 00:99)

2015-05-20 Thread Paul Analyst
Txh, but unfortunatly is not to compute julia> a=[@sprintf("%02d",i) for i = 1:99]; julia> a[1]+a[2] ERROR: MethodError: `+` has no method matching +(::ASCIIString, ::ASCIIString) Closest candidates are: +(::Any, ::Any, ::Any) +(::Any, ::Any, ::Any, ::Any...) I have in string data with ti

Re: [julia-users] Re: How to create own format with two digits 3=03, 10=10, 99=99 (only range 00:99)

2015-05-20 Thread Kristoffer Carlsson
In Julia you concatenate strings with * julia> a=[@sprintf("%02d",i) for i = 1:99]; julia> a[1]*a[2] "0102" On Wednesday, May 20, 2015 at 10:05:08 AM UTC+2, paul analyst wrote: > > Txh, but unfortunatly is not to compute > > julia> a=[@sprintf("%02d",i) for i = 1:99]; > > julia> a[1]+a[2] >

Re: [julia-users] Re: How to create own format with two digits 3=03, 10=10, 99=99 (only range 00:99)

2015-05-20 Thread Paul Analyst
Big thx, but I need: 01*02=02 like 1*2=2 Paul W dniu 2015-05-20 o 14:21, Kristoffer Carlsson pisze: In Julia you concatenate strings with * | julia>a=[@sprintf("%02d",i)fori =1:99]; julia>a[1]*a[2] "0102" | On Wednesday, May 20, 2015 at 10:05:08 AM UTC+2, paul analyst wrote: Txh, but

Re: [julia-users] Re: How to create own format with two digits 3=03, 10=10, 99=99 (only range 00:99)

2015-05-20 Thread Tim Wheeler
Could you just cast your strings to normal integers, do your arithmetic, and then convert it back to a string with the necessary zero-padding? ``` @sprintf("%02d", int("01")*int("02")) ``` On Wednesday, May 20, 2015 at 8:28:03 AM UTC-7, paul analyst wrote: > > Big thx, but I need: > 01*02=02 >

Re: [julia-users] Re: How to create own format with two digits 3=03, 10=10, 99=99 (only range 00:99)

2015-05-20 Thread David Gold
You can convert the strings from Mr Walker's method using parseint() and then give (+) a new method: julia> module Something export a, + a=[@sprintf("%02d",i) for i = 1:99] +(x::ASCIIString, y::ASCIIString) = a[parseint(x) + parseint(y)] end julia> a[1] + a[2] ERR

Re: [julia-users] Re: How to create own format with two digits 3=03, 10=10, 99=99 (only range 00:99)

2015-05-20 Thread David Gold
Mr. Wheeler beat me to it. Here's an example. julia> module Something export a, + a=[@sprintf("%02d",i) for i = 1:99] +(x::ASCIIString, y::ASCIIString) = a[parseint(x) + parseint(y)] end julia> using Something julia> a[1] + a[2] "03" On Wednesday, May 20, 2015 at

Re: [julia-users] Re: How to create own format with two digits 3=03, 10=10, 99=99 (only range 00:99)

2015-05-21 Thread Paul Analyst
This Way now I`am working. I am lookingo for somthing faster. Paul W dniu 2015-05-20 o 17:56, Tim Wheeler pisze: Could you just cast your strings to normal integers, do your arithmetic, and then convert it back to a string with the necessary zero-padding? ``` @sprintf("%02d", int("01")*int("02