02-13-2022, 11:47 PM
Hello,
I am trying to make an adjustment to a macro to remove a 1 or 0 if it's at the start of a string of numbers in my clipboard. Currently I use this macro below in the quote.
It's for formatting phone numbers, because too many things I work with don't use any data validation.
So if someone puts in 15551234567 I want to get only 5551234567 without removing or subbing out the 1 in the middle. Any suggestions?
I am trying to make an adjustment to a macro to remove a 1 or 0 if it's at the start of a string of numbers in my clipboard. Currently I use this macro below in the quote.
It's for formatting phone numbers, because too many things I work with don't use any data validation.
So if someone puts in 15551234567 I want to get only 5551234567 without removing or subbing out the 1 in the middle. Any suggestions?
Quote:str s
;get clipboard text
s.getclip ;;or s.getsel to copy selection
;as an example, convert find space then replace it with nothing
s.findreplace(" " "")
s.findreplace("-" "")
s.findreplace("." "")
s.findreplace("(" "")
s.findreplace(")" "")
s.findreplace("\" "")
s.findreplace("/" "")
;place it to the clipboard
s.setclip ;;or s.setsel to paste directly