Jump to content


Photo

trim off first 12 characters of string


  • Please log in to reply
3 replies to this topic

#1 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 13 September 2006 - 11:33 PM

I have a string varible containing about 20-30 characters. I neet to trim off the first 12 characters of the string variable. I have found a half dozen trim functions but none that do what i want. Does someone know what does this? its probably easy, just need a function or something.

#2 Destruction

Destruction
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 13 September 2006 - 11:36 PM

Have you looked at substr?

<?php
$str = $_GET['str'];
$trimmed = substr($str, 12);
?>

This should return anything after the first 12 characters.

HTH

Dest

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 13 September 2006 - 11:38 PM

You need to use the substr() function.

Ken

#4 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 13 September 2006 - 11:53 PM

Thanks, works great.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users