javascript - jQuery strip first period -
this question has reply here:
split string on first white space occurence 6 answersforgive me if double post, couldn't find similair 1 worked me.
i have domain name ex. google.co.uk
(but can google.com). need split on first period array object this: ["google", "co.uk"]
or ["google", "com"]
in antoher post found this: 'google.co.uk'.split(/.(.+)?/)[1];
doesn't seem work...
can help me? in advance!
replace first . else never turn in string (such |), split off character.
as str.replace replaces first instance of character finds default, code pretty simple:
str = "google.co.uk"; str.replace(".", "|").split("|");
javascript jquery split
No comments:
Post a Comment