Hi,
Sometimes you may need to get all the characters in a string using C Sharp/C#. The following code gives you an example of how to get or display all the characters of a given string.
using System; class MainClass { public static void Main() { string sampleString= "I Love Coding"; for (int num = 0; num < sampleString.Length; num++) { Console.WriteLine("sampleString[" + num + "] = " + sampleString[num]); } } }
Output:
sampleString[0] = I
sampleString[1] =
sampleString[2] = L
sampleString[3] = o
sampleString[4] = v
sampleString[5] = e
sampleString[6] =
sampleString[7] = C
sampleString[8] = o
sampleString[9] = d
sampleString[10] = i
sampleString[11] = n
sampleString[12] = g
🙂
Useful tips! I have been previously hunting for something like this for a long time now. Thank you!
@Andres -> Thanks for the nice comment. Keep in touch. You can expect even more! Always welcome 🙂
hello there. looks like a nice article to me. bookmarking it and will read for sure.
nice post bro. waiting for the next part to show up
@Powerful Xrumer Service- >Thanks for the nice comment. Keep in touch.
@Xrumer Blast Service-> thanks for the nice comment… we will always try to give you the best we can… keep in touch… 🙂
Great review! This is exactly the type of article that needs to be shared around the web. Sad on the Yahoo for not positioning this post higher!