Flum Posted February 18, 2014 Posted February 18, 2014 Hi all, Im trying to replace a string with only relevant information. My first thought was the stringreplace function. The string i wish to cutdown: HospitalInfo.set2("HospitalInfoCash", "<b>Cash</b> - ","€ 1,270,876"); The information i would like to keep is the cash amount: 1,270,876 From the helpfile: #include <MsgBoxConstants.au3> ; Replace a blank space (' ') with a - (minus) character. Local $sString = StringReplace("This is a sentence with whitespace.", " ", "-") Local $iReplacements = @extended MsgBox($MB_SYSTEMMODAL, "", $iReplacements & " replacements were made and the new string is:" & @CRLF & @CRLF & $sString) Now after some research i found out u cant use double quotes. So i searched the forum and found out u should wrap the double quotes into single quotes. So i tried to search on this for the replacement: HospitalInfo.set2('"'HospitalInfoCash'"', '"'<b>Cash</b> - '"','"'€ 1,270,876"); Sadly, i am still getting a syntax error. Could someone point me in the right direction.
FireFox Posted February 18, 2014 Posted February 18, 2014 (edited) Hi, If you want to show quotes in quotes or single quotes in single quotes then double it or wrap it with the contrary like you said. RegEx may be more appropriate : $s = 'HospitalInfo.set2("HospitalInfoCash", "<b>Cash</b> - ","€ 1,270,876");' $a = StringRegExp($s, ' ([\d,]+)"', 3) ConsoleWrite($a[0] & @Lf) _ Br, FireFox. Edited February 18, 2014 by FireFox
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