String Literal

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 writer for Webopedia.com, Enterprise Storage Forum, and CIO Insight. She covers data storage systems and data management, information technology security, and enterprise software solutions.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.

Related Articles

Embedded Analytics

Embedded analytics brings self-service business intelligence to everyday application users.

HRIS

Human resources information system (HRIS) solutions help businesses manage multiple facets of their workforce operations. They provide a central platform for human resources professionals...

Complete List of Cybersecurity Acronyms

Cybersecurity news and best practices are full of acronyms and abbreviations. Without understanding what each one means, it's difficult to comprehend the significance of...

Human Resources Management System

A Human Resources Management System (HRMS) is a software application that supports many functions of a company's Human Resources department, including benefits administration, payroll,...

ScalaHosting

ScalaHosting is a leading managed hosting provider that offers secure, scalable, and affordable...

HRIS

Human resources information system (HRIS) solutions help businesses manage multiple facets of their...

Best Managed Service Providers...

In today's business world, managed services are more critical than ever. They can...