E
E
eldar_web2016-02-15 17:28:59
Ruby on Rails
eldar_web, 2016-02-15 17:28:59

How to find something from the database in Ruby on Rails by removing the signs when checking?

For example, there is a string that I want to find in the database: And in the database there is the same number, but only in this way: 8(960)410-10-10. LIKE doesn't help. How can you find it in this case?
number = '89604101010'

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yuri, 2016-02-15
@modestguy

stackoverflow.com/questions/1621395/how-to-format-...

A
Anton Misyagin, 2016-02-17
@sunnmas

you need to immediately store in the database as 9604101010 as an integer and display it as +7(xxx)xxx-xx-xx or in another format in which you need.

O
OnYourLips, 2016-02-15
@OnYourLips

You need to create a field or index (if the DBMS supports an index by function) with a calculated value of . And already search for it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question