It also seems kind of reasonable to special case string() for Array{Char,1}. It will be inconsistent with other Array stringifications, but print/show/writemime/dump/xdump/showcompact/... can still give emphasize the array property with an array representation.
kl. 06:12:37 UTC+2 onsdag 20. august 2014 skrev John Myles White følgende: > > We should really have a FAQ for this. This is something that tripped me up > for a while. > > I’ll write up sometime. > > — John > > On Aug 19, 2014, at 9:11 PM, Isaiah Norton <isaiah...@gmail.com > <javascript:>> wrote: > > That is the splice operator (also known as "splat"). It causes the > contents of `a` to be passed as indvidual arguments rather than passing `a` > as an array. So, string() behaves differently. > > > On Tue, Aug 19, 2014 at 11:55 PM, Ning Yin <yin...@gmail.com <javascript:> > > wrote: > >> Thanks! That worked. >> >> I also found out that both string(a...) and CharString(a...) worked, >> though I don't understand why the '...' is necessary here. >> >> >> On Tuesday, August 19, 2014 9:50:33 PM UTC+8, Jacob Quinn wrote: >> >>> Try join() >>> >>> >>> On Tue, Aug 19, 2014 at 8:04 AM, Ning Yin <yin...@gmail.com> wrote: >>> >>>> Hi Julia users, >>>> >>>> I was trying to convert an array of char's to string, and I've noticed >>>> functions such as string or CharString, but non of these seem to work for >>>> my case: >>>> >>>> Julia console: >>>> ============== >>>> julia> a = ['a', 'b', 'c'] >>>> 3-element Array{Char,1}: >>>> 'a' >>>> 'b' >>>> 'c' >>>> >>>> julia> string(a) >>>> "Char[a,b,c]" >>>> >>>> julia> CharString(a) >>>> ERROR: ArgumentError("UTF32String data must be NULL-terminated") >>>> =============== >>>> >>>> Any idea? I'm using Julia Version 0.4.0-dev+238 (just cloned from >>>> github). >>>> >>>> Thanks! >>>> -Ning >>> >>> >>> > >