Created
July 11, 2014 13:56
-
-
Save ebouchut/2ae093a75975ccf0fca9 to your computer and use it in GitHub Desktop.
Test if a string start with another string in Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prefix = "http://"; | |
url = "http://example.com"; | |
url.substring(0, prefix.length) === prefix; // true |
Author
ebouchut
commented
Jul 11, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment