ServiceNow Interview Question

put _ between a small and capital character in a string

Interview Answer

Anonymous

Dec 11, 2022

public static void main(String args[]) { String str = "HelloHowAreYouWelcome"; String result = str.replaceAll("()([A-Z])", "$1_$2"); System.out.println(result);

1