My understanding, based on the description in the manual 
<http://julia.readthedocs.org/en/latest/manual/strings/#interpolation>, is 
that what you are trying to do won't be so simple. It sounds like string 
interpolation works by having the compiler replace
"LBP = $LBP"
with
string("LBP = ",LBP)

or something like this - hopefully someone will correct me if I am 
mistaken. There is probably a way you could get around this limitation with 
metaprogramming 
<http://julia.readthedocs.org/en/latest/manual/metaprogramming/>, though 
depending on what you are trying to achieve overall, it might be simpler to 
do some kind of find and replace on your string using values stored in a 
dictionary.

Cheers,

Tom

On Sunday, 26 April 2015 09:11:27 UTC-4, will ship wrote:
>
> Hi Tamas I actually want to completely remove the "\" before the "$"  as I 
> want the following type of operation:
>
> julia> LBP=30
> 30
>
> julia> string ="LBP =$LBP"
> "LBP =30"
>
> Cheers 
> Will
>
> On Sunday, April 26, 2015 at 1:44:05 PM UTC+1, Tamas Papp wrote:
>>
>> Maybe something like 
>>
>> julia> s = "my \\ escaped \\\$ \$ string" 
>> "my \\ escaped \\\$ \$ string" 
>>
>> julia> replace(s, "\\\$", "\$") 
>> "my \\ escaped \$ \$ string" 
>>
>> Best, 
>>
>> Tamas 
>>
>> PS.: Incidentally, is there a way to enter strings with $ without 
>> escaping them? Ie something like a non-standard string literal that just 
>> ignores the $'s. 
>>
>> On Sun, Apr 26 2015, will ship <[email protected]> wrote: 
>>
>> > Hi 
>> > 
>> > I am reading in a text file with special characters e.g. : " Blah is 
>> $LBP" 
>> > when I read it in to a variable the "$" gets replaced with "\$". But I 
>> > actually want the $ non-escaped so that when handling the string 
>> variable 
>> > it prints the $LBP value. 
>> > 
>> > Is there anyway of doing this, our just to remove the "\" in the string 
>> > without removing the "$" as well? 
>> > 
>> > Thanks in advance. 
>> > 
>> > Will 
>>
>

Reply via email to