Here are a few JavaScript functions to mimic the @-function capabilities. I dont like to write every time my own functionals, just because they will be my and I will be proud for them. I don't like this :). I prefer to find some different solutions and take one that better (of course on my opinion)
function rightString(fullString, subString) {
if (fullString.indexOf(subString) == -1) {
return "";
}
else {
return (fullString.substring(fullString.indexOf(subString)+subString.length, fullString.length));
}
}
function leftString(fullString, subString) {
if (fullString.indexOf(subString) == -1) {
return "";
} else {
return (fullString.substring(0, fullString.indexOf(subString)));
}
}
You can find many other functions here site
No comments :
Post a Comment