Char in string
In this chapter you will learn:
Get all characters
using System;//from j a va2s .c o m
class MainClass
{
public static void Main()
{
string myString = "To be or not to be";
for (int count = 0; count < myString.Length; count++)
{
Console.WriteLine("myString[" + count + "] = " + myString[count]);
}
}
}
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- What are the methods we can use to compare strings
- Compare string case sensitively
- Compare string with start index and end index
- Compare strings using StringComparison enumeration: InvariantCulture
Home » C# Tutorial » String