How can I put quotes in a string?

You need to escape the quotation marks to put them in a string. There is two ways of doing this. Using backslashes in a regular string: writeText.WriteLine(“<?xml version=\”1.0\” encoding=\”utf-8\”?>”); Using double quoation marks in a @-delimited string: writeText.WriteLine(@”<?xml version=””1.0″” encoding=””utf-8″”?>”);

Are single/double quotes allowed inside HTML attribute values?

Yes, both quotes are allowed in attribute values, but you must HTML-escape the quote you’re using as an attribute value delimiter, as well as other HTML-special characters like < and &: function encodeHTML(s) { return s.split(‘&’).join(‘&amp;’).split(‘<‘).join(‘&lt;’).split(‘”‘).join(‘&quot;’).split(“‘”).join(‘&#39;’); } var html=”<label my_attr=””+encodeHTML(attr_value)+'”>Text</label>’; However, you are usually much better off not trying to hack a document together from … Read more

Can JSON numbers be quoted?

In JSON, 6 is the number six. “6” is a string containing the digit 6. So the answer to the question “Can json numbers be quoted?” is basically “no,” because if you put them in quotes, they’re not numbers anymore. But, should the parsers accept both “attr” : 6 and “attr” : “6”? Yes, but … Read more

Backslashes in single quoted strings vs. double quoted strings

Double-quoted strings support the full range of escape sequences, as shown below: \a Bell/alert (0x07) \b Backspace (0x08) \e Escape (0x1b) \f Formford (0x0c) \n Newline (0x0a) \r Return (0x0d) \s Space (0x20) \t Tab (0x09) \v Vertical tab (0x0b) For single-quoted strings, two consecutive backslashes are replaced by a single backslash, and a backslash … Read more

PyYAML dump format

Below, ruamel.yaml is used instead. ruamel.yaml is actively maintained. Unlike PyYAML, ruamel.yaml supports: YAML <= 1.2. PyYAML only supports YAML <= 1.1. This is vital, as YAML 1.2 intentionally breaks backward compatibility with YAML 1.1 in several edge cases. This would usually be a bad thing. In this case, this renders YAML 1.2 a strict … Read more