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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply 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: 56221
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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: 26201
    
  66

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: 56221
    
  13

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: 15357
    
    6



Eric
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26201
    
  66

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
tree like select list (html)
string break/flush right
tool tip for link
Adding html tags to script