[kepler-users] how to replace some strings to backslash ("\")?

Christopher Brooks cxh at eecs.berkeley.edu
Fri May 3 15:35:33 PDT 2013


Hi Jianwu,
You would need to protect the backslash with a backslash.
Try replaceAll("a", "\\"")
I'm not sure if that will work.

In general, backslashes are somewhat evil.

For example: Is the string "\bc" three characters: backslash, b and c  
or two characters: backspace and c?

I'm not sure what replaceAll method you are calling here, I'm guessing 
you are invoking that method on a String?

A small test model would help.

I'm not confident that backslashes work well in the expression lange.

_Christopher

On 5/3/13 3:16 PM, Jianwu Wang wrote:
> Hi Christopher,
>
>     I'm using "Expression Evaluator" trying to replace some strings to 
> backslash, such as from "abc" to "\bc". Command like 
> replaceAll("a","\") always has error: Found unterminated string : 
> "\"). Similar attempts also failed.
>
>     I searched Kepler/Ptolemy documents and mailing lists and didn't 
> find answer. Would you please help me out? Thanks.
>

-- 
Christopher Brooks, PMP                       University of California
Academic Program Manager & Software Engineer  US Mail: 337 Cory Hall
CHESS/iCyPhy/Ptolemy/TerraSwarm               Berkeley, CA 94720-1774
cxh at eecs.berkeley.edu, 707.332.0670           (Office: 545Q Cory)



More information about the Kepler-users mailing list