Skip to content

Instantly share code, notes, and snippets.

@cesartalves
Created October 8, 2021 15:15
Show Gist options
  • Save cesartalves/cbf06a891d49d95f0cfd23aafbf182d1 to your computer and use it in GitHub Desktop.
Save cesartalves/cbf06a891d49d95f0cfd23aafbf182d1 to your computer and use it in GitHub Desktop.
string = '1,2,3,4,5,6'
number = true
string.chars.each do |char|
if number && char.number? # pseudo-code
number = false
continue
else
if char.comma?
number = true
continue
end
raise "Nao seque o padrao"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment