Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-28 Thread Nils Gudat
I must admit that I don't entirely understand your original example, so I'm not sure this will help, but given that - as you pointed out - you can add linebreaks into code, why don't you create your string as this is a* multiline string

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-28 Thread J Luis
Thanks, I know I can do it this way but I guess I was caught by surprise when converting a bash script that had line breaks for readability and those line breaks turned out to break the converted code due to the insertion of \n characters. sexta-feira, 28 de Agosto de 2015 às 10:43:52 UTC+1,

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-28 Thread J Luis
No, I'm not constructing a shell command. It's a command indeed but must be a string that will be parsed by the external program. I hope to have some nice examples of it soon. sexta-feira, 28 de Agosto de 2015 às 17:36:17 UTC+1, Stefan Karpinski escreveu: Yes, it does the same thing that the

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-28 Thread Matt Bauman
The backtick command syntax looks like it ignores newlines. http://docs.julialang.org/en/release-0.3/manual/running-external-programs/ If you're constructing shell commands, that is definitely the way to go: julia cmd = `echo hello world` `echo hello world` julia run(cmd) hello world

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-28 Thread Stefan Karpinski
Yes, it does the same thing that the shell does. On Fri, Aug 28, 2015 at 12:31 PM, Matt Bauman mbau...@gmail.com wrote: The backtick command syntax looks like it ignores newlines. http://docs.julialang.org/en/release-0.3/manual/running-external-programs/ If you're constructing shell

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-27 Thread Stefan Karpinski
There are languages that disallow multiline string literals entirely. Among languages that allow multiline string literals (including Ruby and Python with and Perl with here documents), there seem to be none that do what you're suggesting. The fact that no languages seem to do what you suggest,

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-27 Thread J Luis
Can you give an example of any language where that's how it works? No. The only other dynamic language I know is Matlab and it does not even allow creating a string in multiple lines without concatenation ([]). But I guess the point here is what is intended when writing over multiple lines.

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-27 Thread J Luis
I understand that's how it works, but I'm not convinced that is how it should work. For me the newline character should be included only when user requested so, as in julia @sprintf(one line\n another line) one line\n \nanother line quinta-feira, 27 de Agosto de 2015 às 13:08:50 UTC+1,

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-27 Thread Stefan Karpinski
Can you give an example of any language where that's how it works? On Thu, Aug 27, 2015 at 11:26 AM, J Luis jmfl...@gmail.com wrote: I understand that's how it works, but I'm not convinced that is how it should work. For me the newline character should be included only when user requested so,

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-27 Thread Stefan Karpinski
There's a huge difference between newlines in code and strings: code ignores whitespace in general, aside from character escapes, strings capture their contents literally, including whitespace. If strings just ignored whitespace, they would be practically useless. On Thu, Aug 27, 2015 at 2:34 PM,

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-27 Thread J Luis
There are languages that disallow multiline string literals entirely. Among languages that allow multiline string literals (including Ruby and Python with and Perl with here documents), there seem to be none that do what you're suggesting. The fact that no languages seem to do what you

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-27 Thread J Luis
Yes, and we can also do julia replace(@sprintf(one line another line), '\n', ) one line another line but this is ugly and should not be necessary. The more I think on this more it looks like a bug to me. quinta-feira, 27 de Agosto de 2015 às 05:39:59 UTC+1, Tero Frondelius escreveu:

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-27 Thread elextr
Literal strings consist of all the characters between the opening and ending quotes. That includes the end of line characters if they occur between the quotes. The \n is the way Julia prints embedded newline characters in strings to make the character visible similar to the way an embedded

[julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-26 Thread J Luis
I need to build a command as a string to pass to an external program (GMT), so I started to build it this way julia ps = V:\example_23.ps; julia name=Rome; julia pscoast -Rg -JH90/9i -Glightgreen -Sblue -A1000 -Dc -Bg30 -B+t\Distances from * name * to the World\ -K

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-26 Thread Jameson Nash
\e is the shorthand for typing the escape character, you will probably want to escape the backslash like so: `\\`. It looks like you may be trying to create a command string, but you've used string delimiters () instead of cmd delimiters (`). Julia always uses the entire literal string (include

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-26 Thread J Luis
\e is the shorthand for typing the escape character, you will probably want to escape the backslash like so: `\\`. Yes, it was a wrong copy past. Other option is to declare the variable as It looks like you may be trying to create a command string, but you've used string delimiters

Re: [julia-users] Extra '\n' char while creating a string spaning over two lines

2015-08-26 Thread Tero Frondelius
Maybe the trivial solution is the best solution here: julia string = some text here some text here julia string = string * some more text here some text here some more text here julia On Thursday, August 27, 2015 at 2:36:17 AM UTC+3, J Luis wrote: \e is the shorthand for typing the