|char, index| case index when a return false unless char == “-" else return false unless (“0”.."9").include?(char) end end true end def postal_code?(string, a, b) string.match?(/\d{#{a}}-\d{#{b}}/) end w ۭจࣈ͕ೖྗ͞ΕͯUSVF͕ฦ͖ͬͯͯ͠·͏ w ਖ਼نදݱΛ͑ɺͬͱ͍͍ײ͡ʹॻ͚ΔͷͰʁ ࣮ྫʢਖ਼نදݱʣ ˠ؆͔ܿͭਖ਼֬ͳίʔυʹʂ