Skip to content

Tag Archives: Java-String-Programs

Given a String “str” in Java, the task is to convert this string to byte type. Examples: Input: str = "1" Output: 1 Input: str… Read More
Given a string str, the task is to check if this string contains only whitespaces or some text, in Java. Examples: Input: str = "… Read More
Given a string str, the task is to check if this string is null or not, in Java. Examples: Input: str = null Output: True… Read More
Given a string str, the task is to check if this string is empty or not, in Java. Examples: Input: str = "" Output: True… Read More
Below are the various methods to convert an Array to String in Java: Arrays.toString() method: Arrays.toString() method is used to return a string representation of… Read More
Below are the various methods to get the length or size of Strings in Java: string.length(): The length() method is a method which is applicable… Read More
Given a string, the task is to convert this string into a character array in Java. Examples: Input: Hello World Output: [H, e, l, l,… Read More
Given a string and a character, the task is to make a function which counts the occurrence of the given character in the string using… Read More
Given two strings str1 and str2. The task is to check if the two given strings are same if a case-insensitive comparison is followed, i.e.,… Read More
JSON Stand for JavaScript Object Notation. It’s a standard text-based format which shows structured data based on JavaScript object syntax. It is commonly used for… Read More
Given a string, move all Uppercase alphabets char to the end of the String.  Examples:  Input : Geeksforgeeks A Computer Science Portal for Geeks!! Output… Read More
JSON Stand for JavaScript Object Notation. It’s a standard text-based format which shows structured data based on JavaScript object syntax. It is commonly used for… Read More
Given a String, the task is to insert another string in between the given String at a particular specified index in Java. Examples: Input: originalString… Read More
Given a size as n, The task is to generate a random alphanumeric String of this size. Below are various ways to generate random alphanumeric… Read More
There are many ways to compare two Strings in Java: Using == operator Using equals() method Using compareTo() method Using compareToIgnoreCase() method Using compare() method… Read More