0% found this document useful (0 votes)
2 views1 page

Understanding Strings and Their Representation

A string is a collection of characters, which can include alphabets, numbers, symbols, and white spaces. Characters can also include escape sequences like ' ' for a new line and ' ' for a tab space. Strings can be represented using single quotes, double quotes, triple quotes, or triple double quotes, with the rule that single quotes cannot be used inside single quotes.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Understanding Strings and Their Representation

A string is a collection of characters, which can include alphabets, numbers, symbols, and white spaces. Characters can also include escape sequences like ' ' for a new line and ' ' for a tab space. Strings can be represented using single quotes, double quotes, triple quotes, or triple double quotes, with the rule that single quotes cannot be used inside single quotes.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

what is string?

it's just a collection


of characters
what is called a character?
alphabets (a,b,c,A,B...)
numbers (1,2,3,...)
symbols (#,$,%,.,..)
white spaces (' ',escape sequence)
what is called a escape sequence?
it has a specific purpose to do while executing
the code '\n' - new line; '\t' - tab space
'\r' - return carriage
'\' this is called backward slash
how to represent a string?
using single quotes - 'welcome'
double quotes - "welcome"
triple quotes - '''welcome'''
triple double quotes - """welcome"""
rule to represent the strings:
single quotes cannot be used inside the single quotes

You might also like