Is it possible to automatically transform a phone number before calling it? So I want some kind of solution to take a phone number from my call list, contacts or anywhere else, then transform it in a specific way and then add some digits and symbols in front of the number and a symbol after the number, and then forward the newly created number to the dialer.
For example, I have a phone number in my call list &quot;+37066611111&quot;, if I share it as a number in my dialer app (DW contacts and dialer), I get this kind of text:
Contact name:
+37066611111

I want some kind of tool to get this text, drop this part:
Contact name:
+370

Then add additional symbols and digits to the remaining number &quot;66611111&quot;, so that the result would look like this:
866622222,789#9#0866611111#

Then pass this newly created number back to the dialer. Is it possible?
I'm using a bootleggers ROM (Android 9 pie) installed on a Motorola Moto E 2015 phone.
Not all requirements of the question are met in this answer, but this is as close as I got so far, and I'm quite happy with it.
So, this requires to copy the telephone number without the contact name, like this:
+370 666 11111

Next, I used tasker to create a task which reads the number from the clipboard, loses the &quot;+370&quot; and spaces and then adds the additional digits and symbols.
I used the &quot;Variable set&quot; action to set a new variable to %CLIP (this way the copied number in a clipboard is saved to a separate variable, so we can manipulate it further).
Name:
%nr
TO:
%CLIP

Then I used &quot;Variable  Search Replace&quot; action on the new variable to get rid of &quot;+370&quot;. Took me some time to find out how to get rid of the &quot;+&quot; symbol, because tasker doesn't search for &quot;+&quot; in this action, so I used &quot;\D&quot; in the search parameter, which finds any symbols that are not digits, so it worked for me.
Variable:
%nr
Search:
\D370
Replace Matches: checked
Replace with:
08

Then another &quot;Variable  Search Replace&quot; with a space in the search parameter to get rid of the spaces. (the &quot;replace matches&quot; must be checked to delete the found text from the variable)
Variable:
%nr
Search:
 
Replace Matches: checked
Replace with:

Then a &quot;Variable set&quot; action to create a new variable with the additional digits and symbols
Name:
%nrr
TO:
866622222,789#9#%nr#

And lastly - the &quot;System &gt; Set Clipboard&quot; action to copy the transformed number back to clipboard, so I can use it anywhere I like.
Text:
%nrr

Then I created a button in the quick settings to launch this task, so all I have to do is copy the tel. no. which I want to transform, use the quick settings button for the task and paste the new number to my dialer app. Originally I wanted Tasker to forward the new number for the dialer to call, but if I use the &quot;Call&quot; action in tasker, everything after the comma in the new number is not forwarded to the dialer. So pasting the number is good enough for me.
I understand that not many people may want this functionality, but if I help even one, I'm happy. I'm willing to edit the answer so it would be easier to understand, but please tell me how to improve it in that case.