first name wrote in post #1055204:
> [...]
> then later in a different method I have
>
> signature = decrypted[0,77]
> puts "second signature length is #{signature.length}"
>
> => signature length is 77
> [...]
> but it seems like it is not starting counting 0 towards the length,
> which is not the expected behavior. Even though it works when I make the
> range 0,78 it is not how it is supposed to be as far as I can tell,
> because it should be starting at 0 which counts for length 1 and then
> going up to position 77 which counts for 77 other additions to length in
> addition to the first 0.

No, that's a misunderstanding. When you write str[m, n], you get the 
substring with the length n starting at character m. It does *not* 
return the substring between the characters m and n.

For example:
str = "abcdefghijklmnopqrstuvwxyz"
# get the substring with length 3 starting at character 6 ("g")
puts str[6, 3]  # outputs "ghi"

This behaviour is shared by other languages like PHP or JavaScript.

If you want the substring between characters, you have to supply a range 
rather than two integers:

# get the substring between character 2 ("c") and 6 ("g")
str[3..6] # outputs "cdefg"

By the way: If you are not sure about how a method works, you should 
first check the documentation. This will save you a lot of time and 
effort. ;-)

-- 
Posted via http://www.ruby-forum.com/.