Skip to content
Advertisement

Making first letter capital using regex like in ucwords

I need to convert a String value in to Upper case (First letter to upper in every word). This can be done in php by using ucwords() method.

Ex :

JavaScript

Thanks with hi5

Advertisement

Answer

Undermentioned will work great in all your situation

JavaScript

How to use :: Try defining this code n your super class ( Best code practice )

Now when u need to use this method .. just pass String which you need to transform . For Ex:: Let us assume our super class as CommanUtilityClass.java …

Now you need this method in some activity say ” MainActivity.java “

Now create object of super class as :: [ CommanUtilityClass cuc; ]

Final task — use this method as described below:

JavaScript

Let me know if you need more details for that ..

Enjoy

Cheers !

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement