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 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 (") instead of cmd delimiters (`).
>>
>
> Right, its a command string but it needs to be a string that is later
> passed to the external program who will parse it. For example, this does a
> DouglasPeucker line simplification of a ... random line
>
> julia> t = gmt("simplify -T0.2", rand(50,2))
> 40x2 Array{Float64,2}:
> 3.05622e-5 0.225977
> 0.43428 0.902914
> 0.290981 0.230531
> 0.757591 0.71268
> ...
>
>
>> Julia always uses the entire literal string (include embedded newlines)
>> until the closing " character). Because some characters (like a newline)
>> cannot be directly printed, Julia shows it as \n when representing it in ""
>> quotes to display the variable. Similarly, it prints a literal " as \" so
>> that you can tell that the " is part of the string and not indicating the
>> termination of the string.
>>
>
> So, one can't create strings without that '\n' whose construct spans over
> more than one line?
>
>>
>>
>> On Wed, Aug 26, 2015 at 7:00 PM J Luis <[email protected]> wrote:
>>
>>> 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
>>> -Wthinnest > " * ps
>>>
>>> "pscoast -Rg -JH90/9i -Glightgreen -Sblue -A1000 -Dc -Bg30\n
>>> -B+t\"Distances from Rome to the World\" -K -Wthinnest > V:\
>>> example_23.ps"
>>>
>>>
>>> Two things here. Shouldn't the \" show up as quote char in the string
>>> (that is , without the '\')?
>>>
>>> But the second is worst. Why is it adding that '\n' (note it after the
>>> '-Bg30')?
>>> Because of this spurious '\n' the call to the GMT program fails. It does
>>> work if I create the cmd string in a single line but I should not be forced
>>> to do so
>>>
>>> Thanks
>>>
>>> Joaquim
>>>
>>>
>>>