string = "i have a string need to replace every 10th
blank space of the string with some special character.is it possible,
the string does not have any \"\\n\", one single line."

i=0
string.each_byte { |c|
  i+=1
  string[i] = '*' if i%10 == 0
}

puts string




-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to