Shorter than above code will be this line:
return str.replaceFirst("^abc", "");
But in terms of performance I guess there wont be any substantial difference between 2 codes. One uses regex and one doesn’t use regex but does search and substring.
Shorter than above code will be this line:
return str.replaceFirst("^abc", "");
But in terms of performance I guess there wont be any substantial difference between 2 codes. One uses regex and one doesn’t use regex but does search and substring.