c# - Delete word in textbox -


user write sentence in textbox want delete word in sentence after save file.

for example user write

hi name john 

it should output

hi john 
string lines = savetxtbox.text; string newlines; //string removedbreaks = line.replace("\r\n", replacewith).replace("\n", replacewith).replace("\r", replacewith); newlines = lines.replace("name"," "); savefiledialog sfd = new savefiledialog(); sfd.filter = "text documents (*.txt)|*.txt|all files (*.*)|*.*"; sfd.filename = datetime.now.toshortdatestring(); if (sfd.showdialog() == dialogresult.ok) {     totxt(newlines, sfd.filename); } 

but save file cannot delete name word.

i tried this, worked fine.

        string lines = savetxtbox.text;         string newlines = lines.replace("ynatext.", " ");          savefiledialog sfd = new savefiledialog();         sfd.filter = "text documents (*.txt)|*.txt|all files (*.*)|*.*";         sfd.filename = datetime.now.toshortdatestring();          if (sfd.showdialog() == dialogresult.ok)         {             system.io.file.writealltext(sfd.filename, newlines);         } 

do remember need have exact string ynatext. (with period in end) replace it.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -