Monday, January 23, 2012

The Way of the Programmer: String Theory??? lol no.

Happy Inspirational Monday, everyone.

You can do it.

I'm sorry that I haven't been posting recently. I've been busy mangling a sour cream beast inside the mouth of a giant octopus. It was a very sour experience, I must say.

Anyways, back to my lesson. Let's talk about strings. Strings are connected lines of characters, such as the following:
 Now, strings are very important. Sometimes, they are crucial to the very fabric of the program itself. Other times, you won't use them as much as you would integers or other things. I prefer using strings because you can use print them onto the computer in many instances. It also makes it look much more organized.

Generally, you declare a string by saying:
String stringName;
You initialize it in your constructor by saying something like this:
stringName = "This is my string. I like it very much.";
Now, you can do a lot with strings. You can use many things to strings, but we will only talk about a little bit of it today.

Somethings we can do:

  • Print multiple times with the string
  • Organize the string alphabetically
  • Get number of characters
  • Make it print many times while making a random letter disappear. 

Now, I don't mean to frighten you, but next time, we're going to talk about numbers, math, and begin getting into Loops and Arrays. Now, you can do it.

-The Rich Man also known as Thursday (Note that I am not actually rich, but I have a sense of a rich gentlemen).

No comments:

Post a Comment