there're many popular methods used in string class, here're some i want to share with you guys.
let's go!
namespace InsertRemoveAndReplace
{
class Program
{
static void Main(string[] args)
{
string str1 = "Hello, . Welcome to my class.";
string name = "kevin";
int pos = str1.IndexOf(",");
str1 = str1.Insert(pos + 2, name);
Console.WriteLine(str1);
str1 = str1.Remove(pos + 2, name.Length);
Console.WriteLine(str1);
Console.WriteLine("~~~~~~~~~~~~~~~~");
string[] words = new string[] { "recieve","decieve","reciept"};
for (int i = 0; i <= words.GetUpperBound(0); i++)
{
words[i] = words[i].Replace("cie", "cei");
Console.WriteLine(words[i]);
}
}
}
}
Subscribe to:
Post Comments (Atom)


No comments:
Post a Comment