-2
Given a string, you have to take only uppercase and lowercase letters. And in the output show them. How can I achieve this result?
-2
Given a string, you have to take only uppercase and lowercase letters. And in the output show them. How can I achieve this result?
1
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
Browser other questions tagged string ruby
You are not signed in. Login or sign up in order to post.