tom13 Posted May 1, 2007 Posted May 1, 2007 Hi, I want to change ":", " ", "/", "\", """ into "." For just 1 of those I do this: StringReplace("tekst:is:here", ":", ".") But how do I make sure that " ", "/", "\", """ get converted into "." too? Thanks in advance
PsaltyDS Posted May 1, 2007 Posted May 1, 2007 AutoIt does regular expressions:$String = 'A test string, this is: dir ..\temp /p "Test.txt"' $ModString = StringRegExpReplace($String, '[:, /\"]', ".") MsgBox(64, "Results", "Before: " & $String & @CRLF & "After: " & $ModString) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
tom13 Posted May 2, 2007 Author Posted May 2, 2007 (edited) AutoIt does regular expressions: $String = 'A test string, this is: dir ..\temp /p "Test.txt"' $ModString = StringRegExpReplace($String, '[:, /\"]', ".") MsgBox(64, "Results", "Before: " & $String & @CRLF & "After: " & $ModString) Awesome Edit: I fixed it with this, but yours is alot alot cleaner $dateraw = _DateTimeFormat( _NowCalc(),2) $timeraw = _DateTimeFormat( _NowCalc(),5) If StringInStr($dateraw, "/") Then $date = StringReplace($dateraw, "/", ".") ElseIf StringInStr($dateraw, "\") Then $date = StringReplace($dateraw, "\", ".") ElseIf StringInStr($dateraw, ":") Then $date = StringReplace($dateraw, ":", ".") Else $date = $dateraw EndIf If StringInStr($timeraw, "/") Then $time = StringReplace($timeraw, "/", ".") ElseIf StringInStr($timeraw, "\") Then $time = StringReplace($timeraw, "\", ".") ElseIf StringInStr($timeraw, ":") Then $time = StringReplace($timeraw, ":", ".") Else $time = $timeraw EndIf Edited May 2, 2007 by tom13
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