File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes <<<EOF in javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "<<<EOF in javascript?" Watch "<<<EOF in javascript?" New topic
Author

<<<EOF in javascript?

James JVogt
Greenhorn

Joined: May 21, 2007
Posts: 6
var longString = <<<EOF
blah blah blah
blah blah
EOF;

sooo does javascript have something like this? like perl and php do..?>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Perl and PHP are server-side templating and scripting languages. JavaScript is a client-side scripting language with no ability to access files at all. So, no.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
James JVogt
Greenhorn

Joined: May 21, 2007
Posts: 6
umm.... I'm not accessing a file... I'm assigning a variable to a string... that string being "blah blah blah\nblah blah\n"
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29255
    
140

James,
That's called a "here document." I don't think JavaScript has such a thing. You could try searching on "here document" to make sure.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Then what's wrong with:?
James JVogt
Greenhorn

Joined: May 21, 2007
Posts: 6
What happens when you have a string with lots of special chars?

var x = "blah \"blah\" blah...."; and lots of newlines that you want formatted correctly... like, say, 100 lines of text. You don't want to do a bunch of +'s, that is slow. And an array of strings then a join on it is just verbose.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6



Eric
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29255
    
140

Eric,
Cool! JavaScript works like a property file .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <<<EOF in javascript?
 
Similar Threads
shell redirection
Adding html tags to script
tree like select list (html)
tool tip for link
string break/flush right