How can I delete the first word from a line?

Mon 25-Jul-2011

I want to delete the first word “Mon” with javascript jQuery. How can i do this ?

Answer

If you don’t want to split the string (faster, less memory consumed), you can use indexOf() with substr():

var original = "Mon 25-Jul-2011";
var result = original.substr(original.indexOf(" ") + 1);

Leave a Reply

Your email address will not be published. Required fields are marked *