Answers for "take a string and a character, remove that character from string"

0

remove charachter from string

StringBuilder sb = new StringBuilder(inputString);
Posted by: Guest on February-02-2021
0

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;
}
Posted by: Guest on August-11-2021
-1

remove charachter from string

if(String.charAt(1) == String.charAt(2){
   //I want to remove the individual character at index 2. 
}
Posted by: Guest on February-02-2021

Code answers related to "take a string and a character, remove that character from string"

Browse Popular Code Answers by Language