Login  Register

Re: string[] modification

Posted by dscho on Jan 30, 2008; 12:23pm
URL: http://imagej.273.s1.nabble.com/string-modification-tp3697362p3697363.html

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