string[] modification

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

string[] modification

Boizeau marielaure
Hello,
 
 
I would like to selecte a part of a string to remove one part and add an
other. (to save an image with the same raw of name)
I have a list of string[]
For each string[i] i would like to select the four first char and add
for example "Modified" at the end of the string.
 
Thank you for your help
 
Marie
 
 
 
Reply | Threaded
Open this post in threaded view
|

Re: string[] modification

Guido Lütke Wöstmann
Hello,

use the "StringBuffer" or "StringBuilder" Classes for
String-Modification. They are Standard-Java-Classes.
You can find them in the Package "java.lang" (in the
Java-Doc).

Hope this helps,

Guido

Marie-Laure Boizeau schrieb:

> Hello,
>  
>  
> I would like to selecte a part of a string to remove one part and add an
> other. (to save an image with the same raw of name)
> I have a list of string[]
> For each string[i] i would like to select the four first char and add
> for example "Modified" at the end of the string.
>  
> Thank you for your help
>  
> Marie
>  
>  
>  
Reply | Threaded
Open this post in threaded view
|

Re: string[] modification

dscho
In reply to this post by Boizeau marielaure
Hi,

On Wed, 30 Jan 2008, Marie-Laure Boizeau wrote:

> I would like to selecte a part of a string to remove one part and add an
> other. (to save an image with the same raw of name) I have a list of
> string[] For each string[i] i would like to select the four first char
> and add for example "Modified" at the end of the string.

Instances of the String are immutable.  You have to construct new
instances, but that is pretty easy:

        string[i] = string[i].substr(4) + " Modified";

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

erasing pixel groups?

Peter Oslanec
Hi everyone. I would like to ask you if you don´t know any tool that will hepl me to:

I´ve got some microstructure pictures where some areas are off the focus plane, blurry. I would like to get rid of this blurry areas (erase them). Is it possible?

Thanks.

Peto.
Reply | Threaded
Open this post in threaded view
|

Re: string[] modification

Boizeau marielaure
In reply to this post by dscho
Thank you for all your answer,
That work fine.

Code :
String[]  newname=listTIF;
newname[i]= "saignee-" + listTIF[i].substring(0,9)+".tif";
String pathsave =dir+"/imagesretraitees/"+newname[i];
IJ.saveAs("Tiff", pathsave);

Marie


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Johannes Schindelin
Sent: Wednesday, January 30, 2008 1:23 PM
To: [hidden email]
Subject: Re: string[] modification

Hi,

On Wed, 30 Jan 2008, Marie-Laure Boizeau wrote:

> I would like to selecte a part of a string to remove one part and add
> an other. (to save an image with the same raw of name) I have a list
> of string[] For each string[i] i would like to select the four first
> char and add for example "Modified" at the end of the string.

Instances of the String are immutable.  You have to construct new
instances, but that is pretty easy:

        string[i] = string[i].substr(4) + " Modified";

Hth,
Dscho