* Doc O'Leary <
drolear...@2q2013.subsume.com> (18:13) schrieb:
>In article <
87txmwc...@xts.gnuu.de>,
> Simon Krahnke <
over...@gmx.li> wrote:
>
>> I have a string s and I'm only interested in everything in it after the
>> first character.
>>
>> So at the moment I do
>>
>> | s[1,128].bytes
>>
>> Just putting 128 as the length cause that's probably bigger than
>> anything I'll ever enter into my tool. But there's gotta be a better way
>> of doing that except going to Regexps.
>
> Depending on your needs, these spring to mind:
>
>>> here = "this is a string for you"
>=> "this is a string for you"
>>> here[1,here.length]
>=> "his is a string for you"
>>> here[1..-1]
Thank you, I like this one. Didn't come to my mind, that the Range would
do it.
>=> "his is a string for you"
>>> here[0] = ""
>=> ""
>>> here
>=> "his is a string for you"
It's the start of a chain of operations in one line. Likes this:
| when /^h/ then s[1..-1].scan(/../).map { | d | d.hex }
mfg, simon .... binshow.rb replaces
binshow.pl