alvin's blog

A Java String to int conversion example

Java String to int FAQ: How do I convert a String to an int data type in Java?

Answer: You convert a String to an int using the parseInt method of the Java Integer class. The parseInt method converts the String to an int, and throws a NumberFormatException when the String can't be converted to an int type.

Let's take a look at two short examples.

The Tame Swing examples

Digging through my Mac laptop, I just found the old Tame Swing files laying around. These examples are a little old now, but I think they are great examples of the power of the Java Swing framework. Since they are hard to find on the internet I've gathered them into a little collection here.

Currently I just have the Java source code files there, but give me a couple of days and I'll see what I can do to get some of the examples running, and maybe include some screen shots there as well.

 

More Linux find command examples

The Linux find command is used to locate files and directories based on a wide variety of criteria. I'll try to cover the most common find examples here.

Basic find command examples

To find a file or directory named "foo" somewhere below your current directory use a find command like this:

find . -name foo

If the filename begins with "foo" but you can't remember the rest of it, you can use a wildcard character like this:

Linux mv command examples

The Linux mv command lets you move one or more files or directories. Since it's very similar to the cp command, I'll move through this post quickly.

Basic Linux mv examples

To rename a file currently named "foo" to a new file named "bar" just type:

mv foo bar

Although it's called the Linux mv command, it's commonly used to rename files.

To move a file named "foo" to the /tmp directory type:

Linux cp command examples

The Linux cp command lets you copy one or more files or directories. To be clear, the cp command makes a duplicate copy of your information, whereas the mv command moves your information from one location to another.

Let's take a look at some Linux cp command examples.

Simple file copying

Using a Linux or Unix system, to copy a file named "foo" to a new file named "bar" just type:

More Linux grep command examples

The Linux grep command is used to search for text. The name "grep" means something like "general regular expression parser", and if you look at the grep man page it says "print lines matching a pattern". I always tell people that if they don't like the name "grep" they can think of it as "search" instead.

In "grep tutorial", we'll share a number of grep example commands. Let's get started.

Syndicate content