Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- str = "[ASDF ASDF]"
- from, to = [/\[([A-Z][ A-Z_0-9]*)\]/, proc{|s| "\"#{$1.downcase}\""}]
- def doit(str, from, to)
- str.gsub(from, &to)
- end
- doit(str, from, to)
- def doit2(str, from, to)
- to = proc{|s| "\"#{$1.downcase}\""}
- str.gsub(from, &to)
- end
- doit2(str, from, to)
- str.gsub(from, &to)
Add Comment
Please, Sign In to add comment