ruby-uebungen/Assignment_031/solution
Thomas Smits fe2c1c6eb6 Update of exercises 2023-05-25 17:47:19 +02:00
..
readme.md Update of exercises 2023-05-25 17:47:19 +02:00

readme.md

Lösung: Reguläre Ausdrücke: Matching





























































```ruby def reverser(s) /(.*) (.*)/ =~ s "#{$2} #{$1}" end

puts reverser("Ruby Programmierer")


Alternative Lösung:

```ruby
def reverser(s)
  m = /(.*) (.*)/.match(s)
  "#{m[2]} #{m[1]}"
end

puts reverser("Ruby Programmierer")