Answers for "string char remove"

0

remove char from string

def replace_(input_:str,latter:int):
    name_ = ""
    checkList=[]
    for num in range(latter):
        checkList.append(num)
    for i in range(0, len(input_)):
        if i not in checkList:
            name_ = name_ + input_[i]
    return  name_

name_=replace_("give hello",5)
print(name_) #will print hello
Posted by: Guest on June-05-2021
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

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language