Using Strings in Your Code

Updated: January 25, 2022
No Credit Card Required


Every day humans use language to speak and communicate to each other. There are roughly 6500 spoken languages in the world today. The most popular is Mandarin Chinese, there are over a billion people that speak Mandarin.

In written communication, we use characters to express ourselves. Different languages often use different characters. Just like you need to know Mandarin to communicate with another Mandarin speaker. Effectively, a computer would need to know how to write human language to communicate to humans. You don't need to be a computer engineer to talk to your friends all over the world. Communicating with a computer is a completely different story though as letters mean nothing to a computer, unless it's put in a way that you don't really understand. Luckily, a lot of people know how to code output for a computer to communicate directly to a human, a program has to tell it what to do.

Most programming languages have ways you can use text with the help of strings, which organize text in a way that computers can understand. They are necessary to communicate information from the program to the user. When you sign into a website, and it welcomes you, it's probably a result of a text string. While for people there are characters they don't use, computers can use every known character in a text string. Just like question marks, dots, commas, and other characters allow us to read a text differently, strings have other characters telling computers how to interpret them.

The programmer marks the beginning and end of a string with a special character, often within quote marks. The use of quote marks ensures that the characters are being recognized as a text, string, and not as programming language so the computer can then talk to humans. The computer programmer can also make a program that can identify key words and set specific responses to them. This is mostly used in online computer assisted help, where key words are identified by the program. So the right response can be given to questions. For example, if someone types in my phone a program will identify the key words,and a set answer will be given. If you want to communicate with computers, you have to act and think a bit more like them. When a programmer knows how and where to use strings that computer can communicate to users anywhere on the planet. Well, almost.