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]
ERROR: a not defined
julia> using Something
julia> a[1] + a[2]
"03"
On Wednesday, May 20, 2015 at 11:28:03 AM UTC-4, paul analyst wrote:
>
> 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) 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]
>> ERROR: MethodError: `+` has no method matching +(::ASCIIString,
>> ::ASCIIString)
>> Closest candidates are:
>> +(::Any, ::Any, ::Any)
>> +(::Any, ::Any, ::Any, ::Any...)
>>
>> I have in string data with time and i must compute changes only in on 2
>> last position
>> table=
>> 2015-01-01
>> 2015-01-01
>> 2015-01-12
>>
>> I take last two digits
>> int(table[i][9:10])
>> compute somthing
>>
>> and I must put the last two Chars
>> Always i need 2 char '12' or '01'
>>
>>
>>
>> Paul
>>
>>
>>
>> W dniu 2015-05-20 o 09:57, Jeff Waller pisze:
>>
>> *[@sprintf("%02d",i) for i = 1:99]*
>>
>>
>>
>