I want to capitalise everything following a _ using regex.
Example: from en_gb to en_GB
Thanks!
I want to capitalise everything following a _ using regex.
Example: from en_gb to en_GB
Thanks!
I know you should have tried some effort, but I am being nice on a Monday morning with a cup of coffee in my hand.
Use a replace function and use the argument to transform the string.
"en_gb".replace(/_.*/,function(a){return a.toUpperCase();})
This will should change change all after the underscore to uppercase. Tested works
var str="en_gb";
var splitStrg=str.split("_");
splitStrg[1] = splitStrg[1].toUpperCase();
var str = splitStrg.join("_");