module WolfCore::StringUtils
def camelcase_to_spaces(str)
def camelcase_to_spaces(str) return if str.nil? str.gsub(/([A-Z])/, ' \1').strip.downcase.capitalize end
def clean_phone_number(phone)
def clean_phone_number(phone) return if phone.nil? cleaned_phone = phone.to_s.gsub(/\D/, '') last_ten_digits = cleaned_phone[-10, 10] last_ten_digits end
def hash_str_to_json(hash_str)
def hash_str_to_json(hash_str) hash_str&.gsub('=>', ':')&.gsub('\"', '"')&.gsub('{', '{')&.gsub('}', '}')&.gsub(/(\w+)(?=\s*:)/) { |key| "\"#{key}\"" } end
def remove_blank_spaces(str)
def remove_blank_spaces(str) str&.gsub(/\s+/, '') end