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



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

Basic String Manipulation

Working with the members of System.String is as you would expect. Simply create a string data

type and make use of the provided functionality via the dot operator. Do be aware that a few of the

members of System.String are static members, and are therefore called at the class (rather than the

object) level. Assume you have created a new Console Application project named FunWithStrings.

Author the following method, which is called from within Main():

static void BasicStringFunctionality()

{

Console.WriteLine("=> Basic String functionality:");



string firstName = "Freddy";

Console.WriteLine("Value of firstName: {0}", firstName);

Console.WriteLine("firstName has {0} characters.", firstName.Length);

Console.WriteLine("firstName in uppercase: {0}", firstName.ToUpper());

Console.WriteLine("firstName in lowercase: {0}", firstName.ToLower());

Console.WriteLine("firstName contains the letter y?: {0}",

firstName.Contains("y"));

Console.WriteLine("firstName after replace: {0}", firstName.Replace("dy", ""));

Console.WriteLine();

}

Not too much to say here, as this method simply invokes various members (ToUpper(),



Contains(), etc.) on a local string variable to yield various formats and transformations. Figure 3-9

shows the initial output.

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



87

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




Figure 3-9.

Basic string manipulation


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   201   202   203   204   205   206   207   208   ...   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