This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy


string s3 = String.Concat(s1, s2)



Download 21,46 Mb.
Pdf ko'rish
bet207/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   203   204   205   206   207   208   209   210   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

string s3 = String.Concat(s1, s2);

Console.WriteLine(s3);

Console.WriteLine();

}

Escape Characters

Like in other C-based languages, C# string literals may contain various escape characters, which

qualify how the character data should be printed to the output stream. Each escape character

begins with a backslash, followed by a specific token. In case you are a bit rusty on the meanings

behind these escape characters, Table 3-6 lists the more common options.



Table 3-6.

String Literal Escape Characters

Character

Meaning in Life

\'

Inserts a single quote into a string literal.



\"

Inserts a double quote into a string literal.

\\

Inserts a backslash into a string literal. This can be quite helpful when defining file



paths.

\a

Triggers a system alert (beep). For console programs, this can be an audio clue to



the user.

\n

Inserts a new line (on Win32 platforms).



\r

Inserts a carriage return.

\t

Inserts a horizontal tab into the string literal.



For example, to print a string that contains a tab between each word, you can make use of the

\t escape character. As another example, assume you wish to create a string literal that contains

quotation marks, another that defines a directory path, and a final string literal that inserts three

blank lines after printing the character data. To do so without compiler errors, you would need to

make use of the \", \\, and \n escape characters. As well, to annoy any person within a 10 foot

radius from you, notice that I have embedded an alarm within each string literal (to trigger a beep).

Consider the following:

static void EscapeChars()

{

Console.WriteLine("=> Escape characters:\a");



string strWithTabs = "Model\tColor\tSpeed\tPet Name\a ";

Console.WriteLine(strWithTabs);

Console.WriteLine("Everyone loves \"Hello World\"\a ");

Console.WriteLine("C:\\MyApp\\bin\\Debug\a ");

C H A P T E R   3  

C O R E   C #   P R O G R A M M I N G   C O N S T R U C T S, PA RT   I



89

8849CH03.qxd  9/24/07  11:07 AM  Page 89




// Adds a total of 4 blank lines (then beep again!).

Console.WriteLine("All finished.\n\n\n\a ");

Console.WriteLine();

}


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   203   204   205   206   207   208   209   210   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish