From: Rob Biedenharn Date: 2009-01-23T05:22:26+09:00 Subject: Re: Strings - trying to trim values On Jan 22, 2009, at 3:09 PM, Mmcolli00 Mom wrote: > What is the correct way to trim off the the first 37 characters of a > string? > > I want to trim off the value from position 0 -> pos 37 or take off all > characters from right side and stopping at a specific character #. > > myval = wererwerwerwerweritop123233434345556#personID > > How is this done? Thanks. > MC > -- Several ways: irb> myval = 'wererwerwerwerweritop123233434345556#personID' => "wererwerwerwerweritop123233434345556#personID" irb> myval[37..-1] => "personID" irb> myval.split('#',2).last => "personID" irb> myval[/[^#]*\z/] => "personID" Take your pick! -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com