Skip to content

Tag Archives: Java-Strings

Given a string, extract the first letter of each word in it. “Words” are defined as contiguous strings of alphabetic characters i.e. any upper or… Read More
Write a function that takes a String as an argument and prints all unique words in it. Examples: Input : Java is great. Grails is… Read More
Given a string, extract words from it. “Words” are defined as contiguous strings of alphabetic characters i.e. any upper or lower case characters a-z or… Read More
In the article Check if a given string is a valid number, we have discussed general approach to check whether a string is a valid… Read More
Given a string s consisting of upper/lower-case alphabets and empty space characters ‘ ‘, return the length of the last word in the string. If… Read More
Given a string of digits, remove leading zeros from it. Illustrations:  Input : 00000123569Output: 123569 Input: 000012356090Output: 12356090 Recommended: Please try your approach on {IDE}… Read More
Prerequisite: StringJoinerStringJoiner is very useful, when you need to join Strings in a Stream. Task : Suppose we want the string “[George:Sally:Fred]”, where we have given… Read More
Given a string, remove all the leading and trailing spaces from the string and return it. Examples: Input : str = " Hello World "… Read More
This article discusses different ways to reverse a string in Java with examples.  Examples:   Recommended: Please try your approach on {IDE} first, before moving on… Read More
Strings are a very important aspect from a programming perspective as many questions can be framed out among strings. There arise wide varied sets of… Read More
StringTokenizer class in Java is used to break a string into tokens. One must go through StringTokenizer class where concepts and constructors are discussed which… Read More
StringTokenizer class in Java is used to break a string into tokens. A StringTokenizer object internally maintains a current position within the string to be… Read More
The string split() method breaks a given string around matches of the given regular expression. After splitting against the given regular expression, this method returns… Read More
Given two string variables, a and b, your task is to write a Java Program to swap these variables without using any temporary or third… Read More
In Java, while operating upon strings, there are times when we need to convert a number represented as a string into an integer type. We… Read More

Start Your Coding Journey Now!