Alex Rivera | Logout

JavaScript - Split A String

Asked 2012-05-05T18:11:37.850
19

I have a variable that holds the value 'website.html'.

How can I split that variable so it only gives me the 'website'?

Thanks

Edit
Report

1 Answer

3

Another way of doing things using some String manipulation.

var myString = "website.html";
var dotPosition = myString.indexOf(".");
var theBitBeforeTheDot = myString.substring(0, dotPosition);
answered 2012-05-05T18:17:33.890

Your Answer