dragostis dragostis - 1 year ago 107
Java Question

Replace capital letter with underscore + lowercase letter in Java?

Is there a way to use RegEx in Java to replace all capital letters with an underscore and the same letter only lowercase?



hsz hsz
Answer Source

Just try with:

"getSpecialString".replaceAll("([A-Z])", "_$1").toLowerCase();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download