i have a question: How i can check if a string include symbol? It's looking confusing to me:
class Beba
def initialize
while true
puts "Qfar emri deshironi ti vnoni bebes?"
@@emri = gets.chomp.capitalize
if @@emri.scan(/\d+/).empty? && @@emri.scan(/\/./).empty?
puts "Ti e emertove beben me emrin: #{@@emri}"
break
else
puts "Emri nuk mund te jete me numra/simbole, provoni perseri."
end
end
end
end
As you can see, at if@@emri.scan(/\d+/).empty? && @@emri.scan(/\/./).empty?
, i don't know what to do, like which method i can use for @@emri.scan(/\\.\).empty?
to check if don't include any symbol. Thank you.
Aucun commentaire:
Enregistrer un commentaire