Posts Tagged ‘String’

How to check if a Java String is an integer?

Java, Tip 5.6.2015 2 Comments

The Integer class has a number of static methods for parsing strings. For the case where we want to check if if a string contains a valid integer we can use the method Integer.parseInt() and catch the exception that is thrown when the number cannot be parsed.

Read More

Check Palindromes using Recursion

Java 1.6.2011 No Comments

A popular problem is how to determine if a String is a Palindrome or not, the following will also assume we are only dealing with Palindromes of single words ie. no spaces or punctuation. The way to determine this is to compare the characters on the left and right ends of the String. If they…

Read More

Palindromes

Featured, Java 13.4.2011 1 Comment

A popular problem is how to determine if a String is a Palindrome or not, the following will also assume we are only dealing with Palindromes of single words ie. no spaces or punctuation. The way to determine this is to compare the characters on the left and right ends of the String. If they…

Read More
s2Member®