Anda di halaman 1dari 4

ONT1000 / SDS1000 LECTURE 38

LECTURE 38 OBJECTIVES
 Understand how to use a foreach loop
 Understand how to use some handy String methods

LECTURE 38
Not in Textbook

Development Software 1
(ONT1000/SDS1000)

Foreach loop Example 1 Foreach loop Example 2

Foreach “Rules” Just with tabs…


 Will not work for parallel or 2Dim arrays
 Can only be used if you only want to “READ” contents of array
 Can NOT be used to change contents of array

1
ONT1000 / SDS1000 LECTURE 38

With PadRight… PadLeft and PadRight


Length of “new”
string.
Character to add to
“new” string until
length is reached.

ToUpper and ToLower TrimStart and TrimEnd

Insert Length

2
ONT1000 / SDS1000 LECTURE 38

Replace Remove

Substring StartsWith and EndsWith

ToCharArray Split

3
ONT1000 / SDS1000 LECTURE 38

HOMEWORK HOMEWORK (Continued)


 DUE: At the start of your prac next week  Display on Console Window:
 Read from file (create file in the bin\Debug folder):

Right-aligned

NO problems with Names split from


long names and tabs hourly rates

Anda mungkin juga menyukai