Login  Register

Re: substring

Posted by Michael Schmid on Oct 01, 2008; 4:06pm
URL: http://imagej.273.s1.nabble.com/substring-tp3694891p3694896.html

Hi Johannes,

it should be:

               m=dir;
               u="Images";
               uIndex = indexOf(m,u);
               if (uIndex<0) exit("Error: Directory name does not  
contain "+u);
               n=substring (m,uIndex);
               print(n);

Michael
________________________________________________________________

On 1 Oct 2008, at 17:57, Johannes Breu wrote:

> Hello,
>
> I have problems with substring or I don´t get the definition.
> *
> substring(string, index)*
> Returns a substring of *string* that begins at *index* and extends  
> to the
> end of *string*.
>
> Assume that this is dir: C:\Dokumente und Einstellungen\Johannes  
> Breu\Eigene
> Dateien\Platz\Images\IN12/Image0006.tif
>
>                m=dir;
>               u="Images";
>               n=substring (m,u);
>               print(n);
>
> Now I expect n=Images\IN12/Image0006.tif
>
> Instead of this I get an error message:
> n=substring (m,u<)>;
>
> What´s wrong?