I did not find any FAQ entry for this topic (yet), but I think it has been asked frequently enough now that it deserves an entry.
Searching the archives is often usefull: https://groups.google.com/forum/#!searchin/julia-dev/string$20concatenation https://github.com/JuliaLang/julia/search?q=string+concatenation&ref=cmdform&type=Issues The argument is (basically) that it is more mathematically correct, but I have never really cared because * is equally good as + for me. kl. 13:56:26 UTC+1 mandag 20. januar 2014 skrev Sharmila Gopirajan Sivakumar følgende: > > Hi Ivar and Keno, > Thank you. that worked. I'm sorry to bother you on something > that has been documented but i just went with what i used to. May I know > the reason behind using '*' for concatenation instead of '+' which is the > norm? > > Thank you, > > Regards, > Sharmila > > On Sunday, January 19, 2014 1:25:54 AM UTC+5:30, Ivar Nesje wrote: >> >> As Keno says, you should use * for string concatenation in Julia, not + >> as in Python. >> >> If you really, really want, you can "fix" it by adding a new method to +, >> but that might cause other problems, and I think that would be inadvisable >> if you want do distribute a package with your code. >> >> +(a::String, b::String) = a*b >> >> Ivar >> >> kl. 20:12:56 UTC+1 lørdag 18. januar 2014 skrev Keno Fischer følgende: >>> >>> String concat uses `*` rather than `+` >>> >>> >>> On Sat, Jan 18, 2014 at 2:04 PM, Sharmila Gopirajan Sivakumar < >>> [email protected]> wrote: >>> >>>> Hi, >>>> This is about some odd issues I'm experiencing with Julia. When I >>>> try to add 2 strings, >>>> >>>> url = "http://" + domain >>>> >>>> (Here domain is a variable whose value is read from the csv file using >>>> readtable.) >>>> >>>> I get the error "ERROR: no method +(ASCIIString, UTF8String)". But in >>>> julia's Base/strings.jl, there are promote rules to promote asciistring to >>>> utf8string. So why do we get this error? how do I fix it? I would be >>>> quite willing to fix it in Julia. >>>> >>>> Regards, >>>> Sharmila >>>> >>> >>>
