C#:String Functions
From Progzoo
C#:String Functions
The methods and properties of the String type include:
| Example | Value | Comment |
|---|---|---|
| s+" once" | "Andrew was here once" | The strings are concatenated using + |
| s.Equals("another") | false | Tests for equality |
| s.IndexOf("was") | 6 | Returns -1 if the substring is not there. |
| s.Length | 14 | The number of characters |
| s.Split(" ") | ["Andrew","was","here"] | Returns an array of String. |
| s.Substring(2,7) | "drew" | Characters from position 2 to just before 7 |
| s.ToUpper() | "ANDREW WAS HERE" | Also .toLowerCase() |