Ruby on Rails split / explode a string
To explode or split a string using Ruby on Rails:
@m=@tag.split('-')
@my=@m[0];
Then the splitted or exploded value of the string can be accessed by using
<%= @my %>
<%= @m[0] %>
<%= @m[-1] %>
7 Comments:
I don't know if this is similar to explode, but I'm trying to isolate a string from a string-double combo. Such that "25.6 feet" would become "feet"
Any ideas?
Is it always going to be formatted exactly like this?
If so, just do this:
"25.6 feet".split(" ")[1]
That will just become "feet".
it really works
thanks
Kevin
winspector-fans.com
how to do thing like this
"examp\ple".split("\")[1]
This comment has been removed by the author.
I like your post very much. It is very Informative. I hope you to share more info about this.
best data science courses online
I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting Ruby On Rails Course
Post a Comment
<< Home