Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ExtractNumbers(MyString){
  2.     firstdot := 0
  3.     Loop, Parse, MyString
  4.     {
  5.         If A_LoopField is Number
  6.             NewVar .= A_LoopField
  7.         IfInString,A_LoopField,.
  8.         {
  9.             if (firstdot = 0){
  10.                 NewVar .= A_LoopField
  11.                 firstdot := 1
  12.             }
  13.         }
  14.         IfInString,A_LoopField,`,
  15.             NewVar .= A_LoopField
  16.         IfInString,A_LoopField,-
  17.             NewVar .= A_LoopField
  18.     }
  19.     StringReplace, NewVar, NewVar,`,,, ;;remove dots
  20.     ; Remove Leading dashes dots and commas
  21.     NewVar := RegExReplace(NewVar, "^[\-.,]*")
  22.     ; Trailing
  23.     NewVar := RegExReplace(NewVar, "[\-.,]*$")
  24.     Return NewVar
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement