Jump to content


Photo

separate strings


  • Please log in to reply
2 replies to this topic

#1 raila

raila
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 09 April 2006 - 05:51 PM

I have a textfile that contains the following:
< 0> Brann
< 0> Fredrikstad
<4> viking

i whant to separate the "< 0>" (everything between < & >) and the "Name" after the < & >
When i have separated the string i whant to echo"Name" (i.e Brann or Fredrikstad or viking)
whitout the < > and everything between them.

Need all the help i kan get.
thank Raila.

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 09 April 2006 - 07:25 PM

try

$str = '< 0> Fredrikstad';

list(,$number,$name) = split ('[<>]', $str);

echo $number; // --> 0
echo $name; // --> Fredrikstad

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 raila

raila
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 12 April 2006 - 05:33 PM

Thanks for te help :-)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users