Given a string, you have to take only the uppercase and lowercase letters. And on the output show the same. How can I achieve this?
Given a string, you have to take only the uppercase and lowercase letters. And on the output show the same. How can I achieve this?
class String
def pega_maiusculas
self.scan /\p{Upper}/
end
def pega_minusculas
self.scan /\p{Lower}/
end
end
str = "Teste TeStE tEsTe"
maiusculas = str.pega_maiusculas
minusculas = str.pega_minusculas
puts maiusculas
puts "\n"
puts minusculas