i have a text box in whihc i enter free text in form of 1500,my sql,12:12:12 1800, windows ,1:1:1 and so on now i want to retrive and add just the 1st parameter(ie 1500+1800..) of the string pls tell me how can i do tht is thr any string handling function to get the substring -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Prashant Jadhav wrote:> i have a text box in whihc i enter free text in form of > 1500,my sql,12:12:12 > 1800, windows ,1:1:1 > and so on > > now i want to retrive and add just the 1st parameter(ie 1500+1800..) of > the string > pls tell me how can i do tht > is thr any string handling function to get the substringIf its a set number of characters you could use: string[0..3] Or use String.scan with the appropriate regexp - check the documentation. Cheers Luke -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---