I have a string 12346789
how can i get $lastdigits to = "6789"
I need the last 4 characters of a givin string.
Stuart
[man]substr[/man]
But i dont know how long the string is?
I just know i need the last 4 charectors.
did you bother following the link i provided? the manual clearly shows how to do exactly what you are trying to do, there are even examples there too.
Yes i followed the link and saw it took two arguments start and end
Originally posted by stuartbaggs Yes i followed the link and saw it took two arguments start and end
no, [man]substr[/man] can take 3 arguments: the input string, start offset, and length. HINT: the start offset can be negative.
Maybe next time you follow a link you could try reading the page at the other end! 🙂
Originally posted by Weedpacket Maybe next time you follow a link you could try reading the page at the other end! 🙂
specially if the page contains examples which solve your problem directly 😃
I'm glad you have older threads available here, the links included in the post solved my problem in just a few minutes, thanks!!!! Kathy