highlight the double quotes words

This commit is contained in:
Jidong Xiao
2023-10-25 17:13:30 -04:00
parent 9fa616ecde
commit d68c49af08

View File

@@ -271,15 +271,15 @@ if (lastSlashPos != std::string::npos) {
- erase: when doing a phrase search, we enclose our query with double quotes. Unfortunately, the autograder is not smart enough to handle this, and it will pass the double quotes as a part of the query string. And therefore, in your program, you need to remove the double quotes, and you can do so using code like this: - erase: when doing a phrase search, we enclose our query with double quotes. Unfortunately, the autograder is not smart enough to handle this, and it will pass the double quotes as a part of the query string. And therefore, in your program, you need to remove the double quotes, and you can do so using code like this:
```cpp ```cpp
// here tmpString is a string which might contain one double quote character, for example, tmpString might be "Tom, or it might be Cruise".
size_t quotePos; size_t quotePos;
// unfortunately, autograder will pass \" to the command line, and thus the double quote will be a part of the string. // unfortunately, autograder will pass \" to the command line, and thus the double quote will be a part of the string.
if( (quotePos = tmpString.find('"')) != std::string::npos ){ if( (quotePos = tmpString.find('"')) != std::string::npos ){
tmpString.erase(quotePos, 1); // remove the double quote character at the found position tmpString.erase(quotePos, 1); // remove the double quote character at the found position
} }
``` ```
Here *tmpString* is a string which might contain one double quote character, for example, *tmpString* might be **"Tom**, or it might be **Cruise"**.
## Provided Functions ## Provided Functions
Parsing an HTML file and extract all the links from this file may require some regular expression library functions, and using these regular expression library functions is beyond the scope of this course, and thus the following function (which calls regular expression library functions) is provided for you. This function takes a std::string argument, representing the content of an HTML file, and this function will extract all links in this HTML file, and return them as a linked list, represented by an std::list<std::string> object. Parsing an HTML file and extract all the links from this file may require some regular expression library functions, and using these regular expression library functions is beyond the scope of this course, and thus the following function (which calls regular expression library functions) is provided for you. This function takes a std::string argument, representing the content of an HTML file, and this function will extract all links in this HTML file, and return them as a linked list, represented by an std::list<std::string> object.