< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous (in thread)
N :the next (in thread)
|<:the top of this thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
Hi,
2008/9/16 Marco <m / r.co>:
> hi all.
>
> ruby 1.8.5 (2006-08-25) [i386-linux]
>
>>> puts 'hllo'
> hllo
> => nil
>>> puts 'hllo'[0, 2]
> h
> => nil
>>> puts 'hllo'[0, 3]
> h
> => nil
>>> require 'iconv'
> => true
>>> puts 'hllo'[0, 3]
> h
> => nil
>>> puts 'hllo'[0, 2]
> h
> => nil
>>>
>
>
> The character is probably 2 bytes long, so puts 'hllo'[1, 1] returns only
> a "pice" of the character. Is there a way to make this work?
> 'hllo'[0, 2] should return -> h
> and
> 'hllo'[0, 3] should return -> hl
>
> thanks
>
>
You can do it using regular expression :
'hllo'.split(//u)[0, 2].to_s -> h
Regards,
Park Heesob