SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API05 Apr 2007

How do I replace characters in string?

package org.kodejava.lang; public class StringReplace { public static void main(String[] args) { String text = "The quick brown fox jumps over the lazy dog"; System.out.println("Before: " + text); // The replace method replace all occurrences of character // 'o' with 'u' and returns a new string object. text = text.replace('o', 'u'); System.out.println("After : " + […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API03 Apr 2007

How do I copy char array to string?

package org.kodejava.lang; public class CharArrayCopyExample { public static void main(String[] args) { char[] data = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}; // Copy all value in the char array and create a new string out of it. String text = String.valueOf(data); System.out.println(text); // Copy a sub array from the char array […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API02 Apr 2007

How do I remove leading and trailing white space from string?

package org.kodejava.lang; public class TrimStringExample { public static void main(String[] args) { String text = " tattarrattat "; System.out.println("Original = " + text); System.out.println("text.length() = " + text.length()); // The trim() method will result a new string object with a leading and // trailing while space removed. text = text.trim(); System.out.println("Result = " + text); […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API29 Mar 2007

How do I format a number with leading zeros?

This example give you an example using java.text.DecimalFormat class to add leading zeros to a number. For another method you can read the see the earlier example on How do I add leading zeros to a number?. package org.kodejava.text; import java.text.DecimalFormat; import java.text.NumberFormat; public class NumberFormatLeadingZerosExample { public static void main(String[] args) { NumberFormat formatter […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API27 Mar 2007

How do I add leading zeros to a number?

This example shows you how to use the String.format() method to add zero padding to a number. If you just want to print out the result you can use System.out.format(). This method is available since Java 1.5, so If you use a previous version you can use the NumberFormat class, see: How do I format […]

Wayan · 1 min read
JDBC / NOTES</>↗
JDBC23 Mar 2007

How do I create a batch update in JDBC?

A batch statement can be used to execute multiple update commands as single unit in a database manipulation. This statement in the database is not executed one by one but as a single execution instead. In some cases, using a batch update can be more efficient than to execute the commands separately. In this example, […]

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.