omozegie aziegbe

2 posts

Retrieving First n Characters in a String in Java

When working with strings in Java, there are different ways to extract the first n characters efficiently. This article will explore achieving this using standard JDK methods and then showcase alternative approaches using external libraries such as Apache Commons Lang and Guava. 1. Using JDK Methods and Classes Java provides various built-in methods to manipulate …
Read More

Remove Only Trailing Whitespace From a String in Java

In programming, handling whitespace characters within strings often requires careful manipulation, especially when dealing with leading or trailing spaces. Trailing spaces refer to whitespace characters (such as spaces or tabs) that appear at the end of a String while leading spaces occur at the beginning. This article focuses on techniques to specifically remove trailing spaces …
Read More