Java String Tutorial

String Class is a widely used class in java. String Class represents a bunch of characters and is similar to a character array. String class has almost a dozen constructors and can be used to creat

Read More →

String.format java example

In this post we will see String.format java examples. Format method in String returns a formatted string using the specified format string and arguments.

Params : f

Read More →

String trim example

String trim method is used to remove the leading and trailing white spaces in a String.

String trim method example Output [crayon-6

Read More →

String concat example

Concat method of String in java is used to add a new String at the end of the original String.

String concat example Output [crayon

Read More →

String endsWith example

String endsWith is used to check if a String ends with the given suffix.

endsWith() method returns a boolean value based on the suffix passed String endsWith exampl

Read More →

String startsWith example

String startsWith method is used to check if a String starts with a specified substring. Startswith method has 2 variations and we will see both these.

[crayon-62bd

Read More →

String replace methods example

String replace methods are used to replace a part of string with a new string. We have 4 variations for replace in String

String replace(char oldChar, char newChar) returns

Read More →

String lastIndexOf example

String lastIndexOf returns the index of the last occurrence of the given String for specified conditions searching backward. String lastIndexOf method can be used with multiple types of parameters

Read More →

String indexOf example

String indexOf returns the index of the given String for specified conditions. String indexOf method can be used with multiple types of parameters as shown below

1.

Read More →