Home » string

Tag Archives: string

Python Join List Example

In this article, we will explain how to use the function Join List in Python through examples. 1. Introduction Python join() function means concatenating an iterable of strings with a specified delimiter to form a string. Sometimes it’s useful when you have to convert an iterable to a string. 2. How to Use join list in Python The syntax of ...

Read More »

Python String split() Method

Hello in this tutorial, we will see how to use to string split(…) method in python programming. 1. Introduction The split() method splits a string into a list after breaking the given string by a specified delimiter. It is represented by the syntax as: Syntax string.split(delimiter, maxsplit) The method accepts – An optional delimiter attribute defines the string splits at ...

Read More »

Java Write String to a File

1. Intruduction In this tutorial, we will see different ways that Java offers to write a String into a file. We’ll make use of BufferedWriter, PrintWriter, FileOutputStream, DataOutputStream, FileChannel, and Temporary File, and the advantages that each one gives us. 2. BufferedWriter Example In this example, we will use the BufferedWriter class. The BufferedWriter class can be used to write a String ...

Read More »

Char Array to String Java Example

Hello readers! In this tutorial, we feature an example on how to convert a Char Array to String in Java. We will learn different ways of this conversion. Meanwhile, you can also check the String to Char Array Example. 1. Introduction Java programming offers possible ways to convert a character array (char []) to String. A new String is allocated ...

Read More »

Java 8 StringJoiner Example

Hello readers, in this tutorial, we will learn about the Java8 Stream’s API StringJoiner feature and we will explore its different characteristics. 1. Introduction These days in the programming universe joining multiple strings are a common task among the developers. In the ancient Java world, there was no direct way to join the multiple strings. Java8 has introduced a final ...

Read More »

Groovy String Example

1. Introduction String related manipulations have been always important in almost all programming languages. If you are using Groovy, you will do String manipulation in an easy way. In other words, it is very easy to split, add, manipulate, initialize, escape Strings in Groovy. In this tutorial I will show you how to use Groovy String efficiently.       ...

Read More »

StringBuffer Java Example

In this example, we are going to present the StringBuffer class in Java, and StringBuffer vs StringBuilder which is contained in the java.lang package. We are going to show some of its most important uses and methods, and explain why and when it should be used, as well as the difference between StringBuffer and String. 1. String vs StringBuffer Strings in ...

Read More »

Java String Array Example

Last updated Jan. 14, 2019 In this example we will show how to declare and populate a Java String Array as well as how to iterate through all its elements. 1. Example of Java String Array Create a java class named JavaStringArrayExample.java with the following code: JavaStringArrayExample.java package com.javacodegeeks.javabasics.stringarray; public class JavaStringArrayExample { public static void main(String args[]) { // ...

Read More »

Compare Strings

In this example we shall show you how to compare Strings. We are using the methods that the String class provides. To compare Strings one should perform the following steps: Create two new String objects. Use the compareTo(String anotherString) to compare the two Strings. This method compares two strings lexicographically. The comparison is based on the Unicode value of each ...

Read More »