Revision: 13031
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 5, 2009 22:15 by Sephr
Initial Code
if (this.XML && XML.ignoreProcessingInstructions == true)
XML.ignoreProcessingInstructions = false;
function multilineString(spi) { // spi === <?string ...?>
if (typeof spi != "xml")
throw new TypeError(arguments.callee.name);
return spi.toXMLString()
.replace(/^<\?string ([\s\S]*)\?>$/i, "$1")
}
Initial URL
Initial Description
*Requires JavaScript 1.6 or higher*
Syntax: `mutilineString(_<?string?> processing instruction_)`
**Note**: The string processing instruction cannot include ?> in the string and does not support escaped characters (ie. \u0000)
Example:
var string =
LEFT-ANGLE-BRACKET?string foo
bar
baz?RIGHT-ANGLE-BRACKET;
mutilineString(string) == "foo\nbar\nbaz"
Due to a problem with Snipplr, I can't put processing instructions in the comments. Replace LEFT-ANGLE-BRACKET with < and replace RIGHT-ANGLE-BRACKET with >
Initial Title
Multiline Strings [JS 1.6]
Initial Tags
Initial Language
JavaScript