Presentation is loading. Please wait.

Presentation is loading. Please wait.

Compiler Design Second Lecture.

Similar presentations


Presentation on theme: "Compiler Design Second Lecture."— Presentation transcript:

1 Compiler Design Second Lecture

2 Name Example

3 String.ToUpper/ ToLower

4 C# String Substring

5 C# String Substring

6 C# String Index of

7 C# String Index of

8 C# String Contains

9 C# String Contains

10 C# String Spilt

11 C# String Spilt

12 C# String Spilt

13 string[] week = new string[] {"Sunday","Monday","Tuesday"};
C# String Array Arrays is Data Structure, are using for store similar data types grouping as a single unit. We can access Array elements by its numeric index. The array indexes start at zero. Array Declaration and initialization string[] week = new string[] {"Sunday","Monday","Tuesday"}; Retrieve a single item from Array. string str = week[1];

14 string[] week = new string[] {"Sunday","Monday","Tuesday"};
C# Array Examples Array Declaration and initialization string[] week = new string[] {"Sunday","Monday","Tuesday"}; Retrieve a single item from Array. string s = week[1];

15 C# String Array

16 C# String Array Solve the same example using the other declaration

17 C# Char Array How to resize an Array?

18 Sorting Arrays C# Sort Array
You can sort the arrays in ascending order as well as descending . We can use Array.Sort method for sorts the elements in a one-dimensional array.

19 C# Sort char Array

20 C# Sort char in reverse order

21 How to check if a value exists in an array ?

22 C# 2D String Array

23 HW Sort the week days example in descending order.
Read the two string st1= “C# test program” st1= “C# program”, then compare between them if equal return massage “String match” If not equal return massage “String does not match”. St =“for (int count = 0; count < st2.Length - 1; count++)” using String.split() method, split this string.


Download ppt "Compiler Design Second Lecture."

Similar presentations


Ads by Google