
I have a text something like this "25km from N of Rio Negro" I want to add underscore between consecutive Capatalized words having space between them. Can some one give me the solution to it.
regards YJS

class AppendUnderScoreToString
{
public static void main(String[] args)
{
String st="25km from N of Rio Negro";
String newstring=st.replaceAll("(.)([A-Z])", "$1_$2");
System.out.println(newstring);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.