c# remove character from string at index
string s = "This is string";
s = s.Remove(2, 1);
//Output: Ths is string
string s = "This is string";
s = s.Remove(2, 2);
//Output: Th is string
c# remove character from string at index
string s = "This is string";
s = s.Remove(2, 1);
//Output: Ths is string
string s = "This is string";
s = s.Remove(2, 2);
//Output: Th is string
c# Remove String In C#
//The following example removes all characters from a string that are after 25th position in the string.
string founder = "Mahesh Chand is a founder of C# Corner";
// Remove all characters after first 25 chars
string first25 = founder.Remove(25);
Console.WriteLine(first25);
//************************************ ^_*
//The following example removes 12 characters from the 10th position in the string.
// Remove characters start at the 10th position, next 12 characters
String newStr = founder.Remove(10, 12);
Console.WriteLine(newStr);
take a string and a character, remove that character from string
cpp code
int main()
{
string str;
getline(cin,str);
char c;
cin>>c;
string temp="";
for(int i=0; i<str.size(); i++){
if(str[i] == c)
continue;
temp += str[i];
}
cout<<temp;
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us