Re: replace Built-in Macro Function and *None*
Posted by
Gabriel Landini on
Jun 13, 2011; 2:08pm
URL: http://imagej.273.s1.nabble.com/replace-Built-in-Macro-Function-and-None-tp3684287p3684289.html
On Monday 13 Jun 2011 14:51:45 you wrote:
> Hi everyone!!!
> I'm learning imagej Macro programming and need help with an issue regarding
> the Built-in Macro Function: replace(string, old, new). Whenever I want to
> replace a string containing "*None*", it wouldn't work. Does anybody know
> what's going on?
> I send you an example.
>
> string0 = "red=*None* green=*None* blue=*None* gray=*None*";
> print("string0:"+string0);
> string1 = replace(string0, "red=*None*", "red=Ejemplo.tif-Red");
> print("string1: "+string1);
You need to check the Regular Expressions link in the IJ site associated with
"replace".
This seems to work:
string0 = "red=*None* green=*None* blue=*None* gray=*None*";
print("string0:"+string0);
string1 = replace(string0, "red=\\*None\\*", "red=Ejemplo.tif-Red");
print("string1: "+string1);
Cheers
Gabriel