Cutting off a Character from a String

Hello,
I just have a small question - how can I cut off the leading character
of a string? For example, in my case, I have a list of telephone numbers
with a 1 at the beginning… I need to say that if the string is 11
characters long, delete the first character. How can I do this? I am
very new to RoR and the RDOC is kinda confusing…

Thanks in advance,

  • Jeff M.

if string.size == 11
string=string[1…11]
end

On Jan 22, 1:58 pm, Jeff M. [email protected]

or even better…

string=string[1…11] if string.size==11

http://www.noobkit.com/show/ruby/ruby/ruby-core/string

This is where i get all my string info… great site…

Thanks everyone!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs