String is a sequence of characters. In java, string is an immutable object which means it is constant and can cannot be changed once it has been created. In this series, we will learn about String class and String methods in detail along with many other Java String tutorials.
Tutorials in this series:
Java StringString is one of the most widely used class in Java. A Java String contains an immutable sequence of Unicode characters. It is an immutable object which means it is constant and can cannot be changed once it has been created.
Java String MethodsIn Java, a String is an object that represents a sequence of characters. The java.lang.String class is used to create String object. This article will list down several common methods in String class in JDK 8, with sample on how to use those methods
Java 9 - Compact String and String New MethodsBesides two new methods chars() and codePoints(), Java 9 provides compact string which in most cases, will reduce String memory consumption by half.
Java 11 - New Methods in java.lang.StringJava 11, added various new methods in java.lang.String which can change our behavior when working with String. They are: strip(), stripLeading(), stripTrailing(), isBlank(), lines() and repeat(int)
Java 12 - New Methods in StringJava 12 added various new methods in java.lang.String. They are: indent(), transform(), and methods related to JVM Constants API: describeConstable() and resolveConstantDesc().
Java - Convert String to intThere are several options to convert String to int in Java: Integer.parseInt(), Integer.valueOf(), Integer constructor, Integer.decode(), DecimalFormat.parse(), NumberUtils from Apache or Spring, or Guava Ints.tryParse()
Java - Convert String to longConverting from String to a Number is a very common case in programming. Java give us several options to handling this conversion. This article will explain on how we can convert Java String to long, together with it's example.
Java - Convert String to doubleConverting from String to a Number is a very common case in programming. Java give us several options to handling this conversion. This article will explain on how we can convert Java String to double, together with it's example.
Convert String to Date Using SimpleDateFormatMost of programmers is familiar with following task: converting a string into a date. In this article, we will learn how to convert String into Date using java.text.SimpleDateFormat