Month 11

Convert String to LowerCase in Java

Convert String to LowerCase in Java

Convert String to LowerCase in Java Example describes about Converting a String to LowerCase in Java.

For converting a string to lowercase in java, you can use the following method of String class
 
String toLowerCase() will transforms all characters of a particular String into lower case characters according to the current locale.

String toLowerCase(Locale locale) method will transforms all characters of a particular String into lower case characters according to the given Locale specified.

Convert String To UpperCase In Java

Convert String to UpperCase in Java

Convert String to UpperCase in Java Example describes about Converting a String to UpperCase in Java.

For converting a string to uppercase in java, you can use the following method of String class
 
String toUpperCase()  will transforms all characters of a particular String into upper case characters according to the current locale.
 
String toUpperCase(Locale locale) method will transforms all the characters of a particular String into upper case characters according to the given Locale specified.

 

Convert Java Primitive to String

Convert Java Primitive to String

Convert Java Primitive to String Example describes about Converting a Primitive Type Value To String In Java.

There are two ways, you can able to convert java primitive type value into a string.

  • 1) Use String.valueOf() method of String class

  • 2) Using string concatenation operator '+'.

Convert short to String in Java

Convert short to String in Java

Convert short to String in Java Example describes about Convert short to String in Java.

Short class helps to wrap the primitive type value of short in an object.

In addition, It also provides several utility  methods which helps the conversion of short to String and String to short

When you need to Convert short to String in Java, we can use Short.toString(short d) method of Short class, It will convert the short to String.

If you need an Short object in lieu of primitive short, you need to use Short.valueOf(short d) method. This will convert the short primitive to Short Object

Convert char To String in Java

Convert char To String in Java

Convert char To String in Java Example describes about How To Convert char To String in Java.

Character class helps to wrap the primitive type value of char in an object. It also provides several utility functions for determining whether a character is lowercase, uppercase, digit, etc.

In addition, Character class provides several useful methods for dealing with char. When you need to Convert char To String in Java, we can use Character.toString(char c) method of Character class, It will convert the char to String.
If you need an Character object in lieu of primitive char, you can use Character.valueOf(char c). It will convert the char primitive to Character Object