Ruby strings method 👻 (an emoji to catch your attention) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Ruby strings method 👻 (an emoji to catch your attention)

I am new to ruby. If there a method to reveal if a string contains one or more numbers? For example if I want to make a password validator and make sure there are some numbers in input.

30th Dec 2019, 9:35 PM
Katsiaryna Shkirych
Katsiaryna Shkirych - avatar
2 Answers
+ 3
I think you should use regex for this purpose. You can find more info here:https://www.rubyguides.com/2015/06/ruby-regex/
30th Dec 2019, 11:47 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
If there is no such method and I should define it in order to solve the task, please do not tell me, I want to try it myself at first. And if you already know such method please feel free to explain. I would be very thankful!~
30th Dec 2019, 9:40 PM
Katsiaryna Shkirych
Katsiaryna Shkirych - avatar