dcsimg
Main » TERM » S »

String Literal Definition & Meaning

A string literal is a programming string in which characters exist as their literal value rather than a variable and appear the same in code and in published material. They are denoted by delimiters. Delimiters are characters, often quotation marks or brackets, that contain a string literal. In the following example, the quotation marks are delimiters:

" Hello World! "

Programmers can concatenate string literals, typically by placing them directly next to each other:

"Hello" "World" 

equals

"HelloWorld"

In string literals, escape sequences are used to denote characters or functions that are challenging to represent in plain code or that might otherwise cause an error. Escape sequences are often initiated using a backslash (\). If a programmer wishes to represent every single character in a string literal exactly as it is meant to be read, including backslashes or other character combinations that typically represent an escape sequence, they can create a raw string instead.

Raw string vs. string literal

A raw string is a special kind of string literal in which even escape sequences read directly as code rather than performing their usual function.

The character R designates a raw string:

R "(hello)"

in which the quotations or the parentheses can function as delimiters.










LATEST ARTICLES
Texting & Chat Abbreviations

From A3 to ZZZ we list 1,559 text message and online chat abbreviations to help you translate and understand today's texting lingo. Includes Top... Read More »

Huge List of Computer Certifications

Have you heard about a computer certification program but can't figure out if it's right for you? Use this handy list to help you decide. Read More »

STUDY GUIDES
Computer Architecture Study Guide

Computer architecture provides an introduction to system design basics for most computer science students. Read More »

Network Fundamentals Study Guide

Networking fundamentals teaches the building blocks of modern network design. Learn different types of networks, concepts, architecture and... Read More »

The Five Generations of Computers

Learn about each of the five generations of computers and major technology developments that have led to the computing devices that we use... Read More »