Answers for "c# give char by index of sting"

C#
5

letter at index of string c#

string s = "hello";
char c = s[1];
// now c == 'e'
Posted by: Guest on July-01-2020
0

c# insert character into string at position

//Insert method returns a copy, it does not alter the string since strings are immutable
string str = "abc";
str = str.Insert(2, "XYZ"); //str == "abXYZc"
Posted by: Guest on September-28-2020

C# Answers by Framework

Browse Popular Code Answers by Language