Underscore b/w consecutive capatalized words

Underscore b/w consecutive capatalized words

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

View Answers

March 31, 2011 at 5:26 PM

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);

    }
}

Ads









Related Tutorials/Questions & Answers:
Underscore b/w consecutive capatalized words
Underscore b/w consecutive capatalized words  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
diff b/w struts 1.0 and 1.2
diff b/w struts 1.0 and 1.2  diff b/w struts 1.0 and 1.2
Advertisements
diff b/w applet and servlet
diff b/w applet and servlet  what is the difference between applet and servlet?   Difference between servlet and applet: 1)An applet is client side programming whereas servlet is server side programming. 2)Applets run
REQ for connection b/w jdbc and oracle database
REQ for connection b/w jdbc and oracle database    REQ for connection b/w jdbc and oracle database    The Java classes to connect.... b) If you are using oracle thin driver,you have to use: Connection conn
what is difference b/w oracle 8i, 9i and 10g
what is difference b/w oracle 8i, 9i and 10g  what are the difference between oracle 8i,9i and 10g? I am not considering the versions and their supported os, in the interview point of view
how to establish connection b/w java app and mobile phone
how to establish connection b/w java app and mobile phone  hello, my name is Dhanraj. i'm doing a project in my college. In that project we need to send SMS from our phone to a java application situated on a remote server
rexexp pattern to avoid certain words and replace space with underscore
rexexp pattern to avoid certain words and replace space with underscore  I have a text string like "On River Thames in eastern London" and i want to replace space between two capital words with underscore so that "River Thames
underscore as character
underscore as character  how can i consider _ as a character instead of wildcard character? my problem is like this i have 20 records as follows manohar 1234455 manohar 453635 manohar 345454 manohar_1234455 now when i am
ModuleNotFoundError: No module named 'Underscore'
ModuleNotFoundError: No module named 'Underscore'  Hi, My Python... 'Underscore' How to remove the ModuleNotFoundError: No module named 'Underscore' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'django-underscore'
ModuleNotFoundError: No module named 'django-underscore'  Hi, My... named 'django-underscore' How to remove the ModuleNotFoundError: No module named 'django-underscore' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-underscore'
ModuleNotFoundError: No module named 'django-underscore'  Hi, My... named 'django-underscore' How to remove the ModuleNotFoundError: No module named 'django-underscore' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-underscore'
ModuleNotFoundError: No module named 'django-underscore'  Hi, My... named 'django-underscore' How to remove the ModuleNotFoundError: No module named 'django-underscore' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'djungle-underscore'
ModuleNotFoundError: No module named 'djungle-underscore'  Hi, My... named 'djungle-underscore' How to remove the ModuleNotFoundError: No module named 'djungle-underscore' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'XStatic-underscore'
ModuleNotFoundError: No module named 'XStatic-underscore'  Hi, My... named 'XStatic-underscore' How to remove the ModuleNotFoundError: No module named 'XStatic-underscore' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-babel-underscore'
ModuleNotFoundError: No module named 'django-babel-underscore'  Hi...: No module named 'django-babel-underscore' How to remove the ModuleNotFoundError: No module named 'django-babel-underscore' error? Thanks   
ModuleNotFoundError: No module named 'django-babel-underscore'
ModuleNotFoundError: No module named 'django-babel-underscore'  Hi...: No module named 'django-babel-underscore' How to remove the ModuleNotFoundError: No module named 'django-babel-underscore' error? Thanks   
ModuleNotFoundError: No module named 'words'
ModuleNotFoundError: No module named 'words'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'words' How to remove the ModuleNotFoundError: No module named 'words'
Technical words for Business Analyst
Technical words for Business Analyst  Please provide me the list of technical words that a business analyst can use while creating artifacts
Searching English words in a string
Searching English words in a string  My task is to find English words and separate them from a string with concatenated words..for example AhdgdjHOWAREgshshYOUshdhfh I need to find if there exists any English words.   
Count words in a string method?
Count words in a string method?  How do you Count words in a string...(" "); System.out.println("Number of words : "+arr.length); }catch(IOException e... of words : 4 Description: This example counts the number of words into inputted
JavaScript split string into words.
JavaScript split string into words.  How to split string into words.... That is split str into words. Str.split("")-it split str into character. Str.split(" ",3)-split in word and return first 3 words
display co-occurrence words in a file
display co-occurrence words in a file  how to write java program for counting co occurred words in the file
display co-occurrence words in a file
display co-occurrence words in a file  how to write java program for counting co occurred words in the file
Maven dependency for org.webjars.npm - underscore version 1.13.1 is released. Learn to use underscore version 1.13.1 in Maven based Java projects
of underscore released The developers of   org.webjars.npm - underscore project... version of  org.webjars.npm - underscore library is 1.13.1. Developer can use this version ( org.webjars.npm - underscore version 1.13.1 ) in their Java
CONVERT VALUE MONEY TO WORDS IN SQL?
CONVERT VALUE MONEY TO WORDS IN SQL?  i want to covert money or varchar value (like 7500000 ) in words like (75 lacs) then how to convert this value in this words . please give me solution
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer
ModuleNotFoundError: No module named 'amount-in-words'
ModuleNotFoundError: No module named 'amount-in-words'  Hi, My... named 'amount-in-words' How to remove the ModuleNotFoundError: No module named 'amount-in-words' error? Thanks   Hi, In your python

Ads