Jump to content


Photo

Erase chars from a string @ a given point ...


  • Please log in to reply
2 replies to this topic

#1 rem

rem
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 15 June 2006 - 12:24 AM

Hi everybody,

How can I erase all chars in a string after a given point (like / , <>, or . ) ?
ex: This is an example ... I need everything erased after the three points

Thanks a lot, any help would be very appreciated!

Regards,
Rem.

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 15 June 2006 - 12:34 AM

Use a combination of substr and strpos:

[a href=\"http://www.php.net/substr\" target=\"_blank\"]http://www.php.net/substr[/a]
[a href=\"http://www.php.net/strpos\" target=\"_blank\"]http://www.php.net/strpos[/a]
~ D Kuang

#3 rem

rem
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 15 June 2006 - 12:38 AM

[!--quoteo(post=384042:date=Jun 14 2006, 07:34 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 14 2006, 07:34 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Use a combination of substr and strpos:

[a href=\"http://www.php.net/substr\" target=\"_blank\"]http://www.php.net/substr[/a]
[a href=\"http://www.php.net/strpos\" target=\"_blank\"]http://www.php.net/strpos[/a]
[/quote]


Thanks a lot for the tip :)
I'll surelly look into that!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users