i have a string strText with certain value on it,i need to assign '\0' or charactor at the specified position of strText. ie strText[5]='\0'.how is it possible in c#.
2 Answers
You can use the Insert method to specify the index. You need to give it a string though, so if you can replace '\0' with "\0" or else just call .ToString()
strText = strText.Insert(5, yourChar.ToString());
1 Comment
Steve Ellinger
Note that this would add the character at that position, not replace the character at that position with a new one.