hi,
how to remove character in string
my string is Input
1,2,3,4,5,6,7,8,9,10,11,12
out put is (Remove character 1)
2,3,4,5,6,7,8,9,10,11,12
when I use replace funtion than
my output is like this
2,3,4,5,6,7,8,9,0,,2
Thanks,
Jitendra Patel
Replace String in ASP.Net?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

CrishRank #1,486 · 1.1K reputationPosted May 21, 2010, 2:17 AM EDT
No need to use replace function.
use split function and count your length of the string. store this string in array. make loop and for this array, Then start count from 1 not zero using array..
U can also use substring function for starting from particular index of string
Split function :
class TestStringSplit { static void Main() { char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; string text = "one\ttwo three:four,five six seven"; System.Console.WriteLine("Original text: '{0}'", text); string[] words = text.Split(delimiterChars); System.Console.WriteLine("{0} words in text:", words.Length); foreach (string s in words) { System.Console.WriteLine(s); } // Keep the console window open in debug mode. System.Console.WriteLine("Press any key to exit."); System.Console.ReadKey(); } }DRISHTY134 reputationPosted May 21, 2010, 5:27 AM EDT
try this:
string s1="1,2,3,4,5,6,7,8,9,10,11,12";
MessageBox.Show(s1.Substring(2,s1.Length-2));