Click to See Complete Forum and Search --> : String manipulation? (slice)


slyfox
08-01-2005, 03:20 PM
Hi

How do I get the last 4 characters of a string regardless of the length of the string, and then i also want to assign the remainder to another variable.

eg.

var numb = "012345678";

var num1 = "5678";
var num2 = "0123456";

I tried using slice() but it reads from left to right, I need it to read from right to left... I think it can be done without complicating it with "reverse"

Any help please

Orc Scorcher
08-01-2005, 03:24 PM
slice(-4)

slyfox
08-01-2005, 04:14 PM
That was easy! Thanks!