Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/patch_utils/string.rb
Constant Summary collapse
- EMAIL_ADDR_REGEX =
/\A([-_A-Za-z0-9\.]+)@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}\z/- CHINESE_CHARACTER_REGEX =
/\A[\u4e00-\u9fa5]+\z/- CELLPHONE_NUM_REGEX =
/\A1\d{10}\z/
Instance Method Summary collapse
Instance Method Details
#is_cellphone_num? ⇒ Boolean
31 32 33 |
# File 'lib/patch_utils/string.rb', line 31 def is_cellphone_num? !!(CELLPHONE_NUM_REGEX =~ self.strip) end |
#is_chinese_character? ⇒ Boolean
26 27 28 |
# File 'lib/patch_utils/string.rb', line 26 def is_chinese_character? !!(EMAIL_ADDR_REGEX =~ self.strip) end |
#is_email? ⇒ Boolean
21 22 23 |
# File 'lib/patch_utils/string.rb', line 21 def is_email? !!(EMAIL_ADDR_REGEX =~ self.strip) end |