String Search Algorithms for Large Texts 1. Introduction In this article, we’ll show several algorithms for searching for a pattern in a large text. We’ll describe each algorithm with provided code and simple mathematical background. Notice that provided algorithms are not the best way to do a full-text search in… Continue Reading java-full-text-search-algorithms

Java Check a String for Lowercase/Uppercase Letter, Special Character and Digit 1. Overview In this quick tutorial, we’ll illustrate how we can check if a String is containing at least one of each of the following: uppercase letter, lowercase letter, digit or special character in Java. 2. Using Regular Expressions… Continue Reading java-lowercase-uppercase-special-character-digit-regex

String Performance Hints ** 1. Introduction In this tutorial, we’re going to focus on the performance aspect of the Java String API. We’ll dig into String creation, conversion and modification operations to analyze the available options and compare their efficiency. The suggestions we’re going to make won’t be necessarily the… Continue Reading java-string-performance

Converting Java String to Double 1. Overview In this tutorial, we’ll cover many ways of converting a String into a double in Java. 2. Double.parseDouble We can convert a String to a double using the Double.parseDouble method: assertEquals(1.23, Double.parseDouble(“1.23”), 0.000001); 3. Double.valueOf Similarly, we can convert a String into a boxed Double using… Continue Reading java-string-to-double

String Initialization in Java 1. Introduction Java String is one of the most important classes and we’ve already covered a lot of its aspects in our String-related series of tutorials. In this tutorial, we’ll focus on String initialization in Java. 2. Creation First of all, we should remember how Strings are… Continue Reading java-string-initialization

Replace a Character at a Specific Index in a String in Java 1. Introduction In this quick tutorial, we’ll demonstrate how to replace a character at a specific index in a String in Java. We’ll present four implementations of simple methods that take the original String, a character, and the index… Continue Reading java-replace-character-at-index