Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Macro for clipboard number formatting
#1
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?
 
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


Messages In This Thread
Macro for clipboard number formatting - by gamergirl151 - 02-13-2022, 11:47 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)