Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的一个测试中,我想检查一个值是否是 0-9 之间的八位数字并使其更通用,我该如何在 Ruby 中做到这一点?
示例:36756786、38796809 等。
试试这个:
numberString =~ /\A(\d){8}\Z/