A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings. Even "12345" could be considered a string, if specified correctly. Typically, programmers must enclose strings in quotation marks for the data to recognized as a string and not a number or variable name.

For example, in the comparison:

if (Option1 == Option2) then ...

Option1 and Option2 may be variables containing integers, strings, or other data. If the values are the same, the test returns a value of true, otherwise the result is false. In the comparison:

if ("Option1" == "Option2") then ...

Option1 and Option2 are being treated as strings. Therefore the test is comparing the words "Option1" and "Option2," which would return false. The length of a string is often determined by using a null character.

Updated in 2006 by Per C.

quizTest Your Knowledge

Which of the following best describes a keystroke?

It is a type of authentication that requires a private key.
It is an algorithm that compares keywords against an index of files.
It is the character or symbol painted on an individual keyboard key.
It is pressing a single key on a keyboard.
Correct! Incorrect!     View the Keystroke definition.
More Quizzes →

The Tech Terms Computer Dictionary

The definition of String on this page is an original definition written by the team. If you would like to reference this page or cite this definition, please use the green citation links above.

The goal of is to explain computer terminology in a way that is easy to understand. We strive for simplicity and accuracy with every definition we publish. If you have feedback about this definition or would like to suggest a new technical term, please contact us.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe or change your frequency setting at any time using the links available in each email.

Questions? Please contact us.