I have a receiving system that cannot handle a telephone extension and “dashes” sent in a IN1:7. So for example, the engine receives (800)-555-1111X1234. They only want to receive 1(800)5551111. I was able to create some tcl code based on the “X” in the string. But my code returns an empty string if “X” is not found in the phone number. Here is my code:
lassign $xlateInVals num
set a [ string first “X” $num]
set newnum [string range $num 0 [ expr $a – 1 ] ]
set xlateOutVals [ list $newnum ]
What I like to do is look for both “X” or “x” and only send everything to the left of “X” or “x”. I need to always remove the dashes. I would to put this in a proc for reuse. Any help, greatly appreciated 8)