How get a substring of a string

hello all

i want to get the substring of a string

i found a source that do it…but don’t work in my machine

example

“the source of ruby”.chars[0…5]

that must return “the so”

Just use the syntax…without “chars”

e.g.
a=“the source of ruby”
a[0…5] => “the so”

_Hari

View this message in context:
http://www.nabble.com/how-get-a-substring-of-a-string-tf1927484.html#a5279004
Sent from the RubyOnRails Users forum at Nabble.com.

tanks

Nara H.

it work very well

i need it to resolve the number of day in the week…
i’ll get it from the string that return the function Date.today
i’l take the three first characters to identify the day

:slight_smile:

tankes

Or you can use strftime. That is Time.now.strftime(“%b”)

look at strftime
for other usages of strftime.

sail wrote on 12.07.2006 00:44:

i’l take the three first characters to identify the day
Mmh?
You use Date. Why you don’t use Date.today.wday?