Hi can any one suggest a code to return specific characters from string like: Thursday, Jan 17 to 23, 2013 I need to get number 23, or sometimes it can be 5 or 3 for example. I need the number after text "to" Thank you all in advance
on 2013-01-23 17:41
on 2013-01-23 21:25
Alexander G. wrote in post #1093339: > Hi > > can any one suggest a code to return specific characters from string > like: > Thursday, Jan 17 to > 23, 2013 > > I need to get number 23, or sometimes it can be 5 or 3 for example. > I need the number after text "to" > > Thank you all in advance Resolved: exp = Thursday, Jan 17 to 23, 2013t i = 0 exp.scan(/\d+/) do |x| i = i + 1 if i == 2 @exp_day = x end puts @exp_day =>23
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.