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.






Jenna Phipps
Jenna Phipps
Jenna Phipps is a contributor for websites such as Webopedia.com and Enterprise Storage Forum. She writes about information technology security, networking, and data storage. Jenna lives in Nashville, TN.

Top Articles

Huge List Of Texting and Online 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...

How To Create A Desktop Shortcut To A Website

This Webopedia guide will show you how to create a desktop shortcut to a website using Firefox, Chrome or Internet Explorer (IE). Creating a desktop...

The History Of Windows Operating Systems

Microsoft Windows is a family of operating systems. We look at the history of Microsoft's Windows operating systems (Windows OS) from 1985 to present...

Hotmail [Outlook] Email Accounts

  By Vangie Beal Hotmail is one of the first public webmail services that can be accessed from any web browser. Prior to Hotmail and its...

Unregulated Power Supply Definition...

An unregulated power supply is a system that transforms input voltage into direct...

Cybersecurity Awareness Training Definition...

Cybersecurity awareness training informs employees of the attack surfaces and vectors in their...

OST File Definition &...

An OST file, or offline storage table (.ost) file, is an Offline Outlook...