Login  Register

Re: About split function

Posted by lechristophe on Aug 09, 2010; 1:49pm
URL: http://imagej.273.s1.nabble.com/About-split-function-tp3687320p3687321.html

Dear Luis,

\ is used for reserved characters, such that \n is for a line break, etc.
so \ by itself is a reserved character, so you have double it in a
string ("\\").
In other terms, the character "\" has to be written "\\" when using strings.

Christophe

2010/8/9 Luis Isaac Ramos Garcia <[hidden email]>:

>   Dear community;
>
>   I would like to split into an array a list of 58 numbers that appear in a
> line in the Image Info. In the line the numbers are joint by "\", for
> example:
>
> -15\-15\-15\-15\-15\-15\-15\-45\-45\-45\-55\-55\-25\-55\-75\-75\-65\-65\-65\-55\-35\-35\-5\-5\-5\-5\-5\-5\-5\-15\-15\-15\-15\-15\-15\-15\-15\-15\-15\-15\-15\-15\-5\-5\-5\-5\-5\-5\-5\-5\-5\-5\-5\-5\-5\-5\-5\-5
>
>   The problem is that in use the following sentence in macro language:
>
>   a=split(TxT,"\");
>
>   I receive an error.
>   The problem is in the "\", because if I use or example "5", I have no
> problem to split the line, obviously getting incorrect results.
>
>   What is wrong in the use of "\"?
>
>   Many thanks,
>
>
>
> --
> Dr Luis Isaac Ramos Garcia
> Departamento de Oncologia
> Clinica Universidad de Navarra
> Facultad de Medicina,Universidad de Navarra
> Av. Pio XII nÂș36, 31008 Pamplona, Spain
> Fax: +34 948255500
> TEL: +34 948255400 (Ext. 4924)
> E-mail: [hidden email]
> Web Page: http://www.cun.es
>