Search and replace

  1. string search (string filename, string word). This function takes a file name and a word and returns a string with the first line where this word exists, preceded by the line number, e.g. if we seach for the word “positive”, it may return:
     “I found the word positive at line 4: Think positive. Talk positive.”
    This function should allow partial search for part of a word followed by the * operator which means any letters. For example: if we search for he*, then the result will be something like:
     “I found the word help at line 3: “Allah will help the person”
     “I found the word helping at line 3: “who is helping his brother”
  2. string replace (string filename, string word, string newWord). It replaces all the occurrences of the word with the newWord and saves the file again.