• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)

Java String

How To Split String In Java

April 7, 2014 //  by Krishna Srinivasan//  Leave a Comment

If you want to split the String value into the different parts based on the delimiter or regular expression, String class provides split() which does the job. It has two overloaded methods with the following syntax: split(String regex) – Splits this string around matches of the given regular expression. split(String regex, int limit) – Splits …

Category: JavaTag: Java String

Java String IndexOf Example

April 6, 2014 //  by Krishna Srinivasan//  Leave a Comment

Java String class consist of methods for finding the index of occurrence in the given string literals. If there is no occurrence of the given characters, then it will return the “-1”.  The following are the few methods which is very useful to find the string values. indexOf(char) – Returns the index of the character …

Category: JavaTag: Java String

Java String Reverse using Recursion

April 6, 2014 //  by Krishna Srinivasan//  Leave a Comment

This example shows how to reverse a string using the recursion technique. There are several ways to reverse a string one I have explained using the StringBuffer. Note: The best way is not to choose recursion technique for reversing the string. These concepts are usually used to teach students the recursion , not actual best practices …

Category: JavaTag: Java String

Java String Reverse using StringBuffer Example

April 6, 2014 //  by Krishna Srinivasan//  Leave a Comment

In this example we shall show you how to reverse the string object by using the Java StringBuffer class. StringBuffer class has a method reverse() which is convenient for reversing a given string value. As it is define in the specification: Causes this character sequence to be replaced by the reverse of the sequence. If …

Category: JavaTag: Java String

Java String ReplaceAll Method Example

April 6, 2014 //  by Krishna Srinivasan//  Leave a Comment

In this example we shall explain the replaceAll() method in the String class. With the replaceAll() method we can replace the whole or part of the string or character sequences. String objects are immutable and cannot be changed the value. When ever you change the value, new string object is created. This method also creates …

Category: JavaTag: Java String

Java String Intern Method Example

April 6, 2014 //  by Krishna Srinivasan//  Leave a Comment

String manipulation is one of the most read and confused subject for the Java programmers. String literals are stored in the string pool where identical objects are pointing to the same reference. If you look at the below example, we have created the “JavaBeat” string using the literals and “new” operator. When we create the …

Category: JavaTag: Java String

Java – String matches() Method Example

March 20, 2014 //  by Krishna Srinivasan//  Leave a Comment

This example shows how to use the String.matches() method for testing the regular expressions against any other strings. Using the regular expressions are very efficient to save lot of code for the validations. For example, you can use the pre-defined regular expression to validate the email address without extra code. [code lang=”java”] package javabeat.net.util; /** …

Category: JavaTag: Java String

How To Convert String To Byte In Java?

January 23, 2014 //  by Krishna Srinivasan//  Leave a Comment

This tutorial highlights the simple example to demonstrates how to convert a string object to the byte stream. We can simply use the getBytes() method in the string object to convert the string to bytes array. Lets look at the example program. [code lang=”java”] package javabeat.net.core; public class StringToByteExample { public static void main(String[] argv) { …

Category: JavaTag: Java Basics, Java String

  • Go to page 1
  • Go to page 2
  • Go to Next Page »

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

np.zeros

A Complete Guide To NumPy Functions in Python For Beginners

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact