I'm trying to write a few ruby programs which can insert two letters within a string just behind the recipes . I am trying to use two classes within a main square by passing the characters of a string in the block associated with class method. One method will insert letters, others can remove them.
Even what I have so far:
class mytranslator def to my_trans (string) letters = string Inject ('this') {| Characters, Characters | The collection + = four} puts the end of the letters DEF, under the end is the problem, I do not know I am on the right track. And I do not know how to write another method. Any help would be greatly appreciated. Thank you.
def to_mytrans s.gsub (/ ([^ aiouAEIOU]), '\ 1it ') End DEF to_normaltrans (s) s.gsub (/ ([^ aeiouAEIOU]) /,' \ 1 ') This will fail if your string numbers / punctuation marks are .
Comments
Post a Comment