d0n Posted April 26, 2010 Share Posted April 26, 2010 If a string has both " and ' in it, how do i quote it ?? ex. $String = Jim said "This is his' house" how do i quote it? Link to comment Share on other sites More sharing options...
MrMitchell Posted April 26, 2010 Share Posted April 26, 2010 (edited) Put double quotes around the entire string, double-double quote anywhere you want a double quote to appear within the string. $string = " Jim said ""This is his' house"" " MsgBox(0, "", $string) Alternatively put single quotes around the entire string then double-single quote anywhere you want single quotes to appear within the string: $string = ' Jim said "This is his'' house" ' Full explanation on this page: http://www.autoitscript.com/autoit3/docs/intro/lang_datatypes.htm Edited April 26, 2010 by MrMitchell Link to comment Share on other sites More sharing options...
czardas Posted April 26, 2010 Share Posted April 26, 2010 (edited) As an alternative: you can also introduce the the double quotation marks as ascii codes. $string = "$string = "&Chr(34)&" Jim said "&Chr(34)&Chr(34)&"This is his' house"&Chr(34)&Chr(34)&Chr(34) MsgBox(0, "", $string) I sometimes do this if I want to introduce characters, into my code, which normally form part of (or may interfere with) autoit syntax: I also find it easier to visualize in certain situations. Although it is probably less efficient here, I find I am less likely to make mistakes when using this method. Edited April 26, 2010 by czardas operator64 ArrayWorkshop 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