From: Paul Lutus Date: 2006-09-16T01:20:54+09:00 Subject: Re: Need help about Ruby with text file Oscar Lok wrote: / ... > Thanks a lots! > Ruby script really is a great script! > By the way, may I know that is there any function like e.g. left(line, > 3), right(line, 2) and mid(line, 1, 4) to extract letter from a line, > please? > e.g. > mid(gghhii,3,2) return hh > left(gghhii,3) return ggh > right(gghhii,3) return hii #!/usr/bin/ruby s = "gghhii" puts s puts s[0,2] puts s[2,2] puts s[-2,2] Output: gghhii gg hh ii -- Paul Lutus http://www.arachnoid.com