Blacktongue Posted January 5, 2007 Share Posted January 5, 2007 Hi: This is first day with AutoIT and I like it. I am used to winbatch but I cannot find an equivalent function for $a = strclean($a,"1234567890ABCDEFGBPD","",false,2) ..... this strips all the characters out of the string except for "1234567890ABCDEFGBPD" How can I do this with AutoIt? I did some searches but could not find it.. Thanks, RB Link to comment Share on other sites More sharing options...
Zedna Posted January 5, 2007 Share Posted January 5, 2007 Make your own UDF (User Defined Function) for it, it's simple. You can have it as your first script Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Blacktongue Posted January 6, 2007 Author Share Posted January 6, 2007 I ended up with something like this: (the clipboard contains the string to be stripped.) $a=ClipGet() $a=StringRegExpReplace($a, "[[:space:]]", "") MsgBox(0, $a, StringRegExpReplace($a, "[^ 0123456789ABCDEFGHI ]", "")) that strips out everything but 0123456789ABCDEFGHI and the 'space'...couldnt get that to work in the same function a UDF was suggested but I havent learned that yet...... Link to comment Share on other sites More sharing options...
Zedna Posted January 6, 2007 Share Posted January 6, 2007 $a = "Test string 123 aBc" $a = strclean($a,"1234567890ABCDEFGBPD") MsgBox(0,"Result",$a) Func strclean($a,$B) Return StringRegExpReplace($a, "[^" & $b & "]", "") EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now