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
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
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, 2013I 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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs