Hi there, can anyone explain to me how I have to understand the: %s in the following code line: yield :error, "There was a problem resending your activation code, please try again or %s.", "resend_activation_path" Whant does it stand for, what does it mean, what does it do? Thanks! Tom -- 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 -~----------~----~----~----~------~----~------~--~---
Tom Ha wrote:> yield :error, "There was a problem resending your activation code, > please try again or %s.", "resend_activation_path" > > Whant does it stand for, what does it mean, what does it do?Google for "printf", alone. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
2009/4/9 Tom Ha <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > Hi there, > > can anyone explain to me how I have to understand the: > > %s > > in the following code line: > > yield :error, "There was a problem resending your activation code, > please try again or %s.", "resend_activation_path" > > Whant does it stand for, what does it mean, what does it do? >I''m not familiar with that particular bit of code, but I think this relates to the "%" method for String classes in ruby. See http://www.ruby-doc.org/core/classes/String.html#M000785 . This is ruby''s way of doing format control letters and modifiers. If you''ve programmed in C etc or something like awk, you often use these in print statements (eg printf) to format strings and numbers etc. Whenever I have to look these up I check out the gawk reference - here''s one online: http://www.gnu.org/software/gawk/manual/gawk.html#Control-Letters Simple example in ruby: "foo%s" % "bar" => "foobar" "foo%05d" % 1 => "foo00001" -- Daniel Bush http://blog.web17.com.au http://github.com/danielbush/sifs/tree/master http://github.com/danielbush --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks a lot! -- 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 -~----------~----~----~----~------~----~------~--~---