Specifically,

   - Conceptually, a string is a *partial function* from indices to 
   characters: for some index values, no character value is returned, and 
   instead an exception is thrown. This allows for efficient indexing into 
   strings by the byte index of an encoded representation rather than by a 
   character index, which cannot be implemented both efficiently and simply 
   for variable-width encodings of Unicode strings.


On Thursday, October 20, 2016 at 7:43:22 PM UTC+2, Kristoffer Carlsson 
wrote:
>
> Please read http://docs.julialang.org/en/release-0.5/manual/strings/
>
> On Thursday, October 20, 2016 at 7:34:03 PM UTC+2, program...@gmail.com 
> wrote:
>>
>> What wrong  ? 
>> julia> o=open("string.txt","w")
>> IOStream(<file string.txt>)
>>
>> julia> write(o,b)
>> 12
>>
>> julia> close(o)
>>
>> julia> o=open("string.txt")
>> IOStream(<file string.txt>)
>>
>> julia> temp=readline()
>>
>> "\r\n"
>>
>> julia> temp=readline(o)
>> "sa sdś aa,1"
>>
>> julia>
>>
>> julia> temp[6]
>> 'ś'
>>
>> julia> temp[7]
>> ERROR: UnicodeError: invalid character index
>>  in slow_utf8_next(::Array{UInt8,1}, ::UInt8, ::Int64) at 
>> .\strings\string.jl:67
>>  in next at .\strings\string.jl:92 [inlined]
>>  in getindex(::String, ::Int64) at .\strings\basic.jl:70
>>
>> julia> temp
>> "sa sdś aa,1"
>>
>> julia> eltype(temp)
>> Char
>>
>> julia> typeof(temp)
>> String
>>
>> julia> temp[3]
>> ' '
>>
>> Paul
>>
>>

Reply via email to