[DGD] Explode() question

S. Foley s_d_foley at hotmail.com
Tue Jan 1 09:36:41 CET 2002




Shevek <shevek at btinternet.com> wrote:

>More of a question of am I using it right than is something wrong.
>Is this expected behaviour from explode?
>
>Read a file into some string str, file contains this line.
>string1:string2:string3
>Now explode(str,":") into an array arrstr.
>Here is the problem, the final element of arrstr is now string3 + some
>unknown control character, so trying to check a string to see if it's a
>member of arrstr will fail if the string=string3.

Err...Are we talking a line feed here?  Each line in a file is terminated by 
\n (a line feed).  Obviously the code you posted would work fine for lopping 
off the line feed.  You could make it work for you instead by putting each 
string on a separate line and just exploding the string returned by 
read_file on \n, skipping a step, but I suspect that approach might not be 
appropriate for what you are doing.

--Steve F.

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list