lundi 25 janvier 2016

Replace parts of string in sqlite3

I want to replace parts information in my strings.

e.g. From +1-2024561111 To +1-202***1111

I found a query REPLICATE which could achieve what I want. However, it seems not available in sqlite3.

And the REPLACE in sqlite can only replace some certain strings. What I need is to replace strings in certain positions. One alphabet replaces one '*' ; they need to have the same length after replacing.

Even the Excel can do this easily by using REPLACE(old_text, start_num, num_chars, new_text). Is there any way to solve this? BTW, I'm using sqlite3 in python. The solution written in python is also acceptable.

Aucun commentaire:

Enregistrer un commentaire