String library comments updated

This commit is contained in:
2019-11-19 00:25:55 +01:00
parent 80e443cda2
commit 36df0e1809
2 changed files with 12 additions and 20 deletions
+3 -3
View File
@@ -175,10 +175,10 @@ namespace c0ding {
return delim; return delim;
} }
void string::replace(const std::string& target, const std::string& replacement) { void string::replace(const std::string& value, const std::string& replacement) {
std::string::size_type found = 0; std::string::size_type found = 0;
while ((found = data.find(target, found + replacement.length())) != std::string::npos) { while ((found = data.find(value, found + replacement.length())) != std::string::npos) {
data.replace(found, target.length(), replacement); data.replace(found, value.length(), replacement);
} }
} }
+9 -17
View File
@@ -247,7 +247,7 @@ namespace c0ding {
friend std::ostream& operator<<(std::ostream& os, const string& str); friend std::ostream& operator<<(std::ostream& os, const string& str);
/** /**
* Tries to erase the first line of the given string which contains the sequence. * Tries to erase the first line of the string which contains {@param sequence}.
* *
* @param sequence The sequence. * @param sequence The sequence.
*/ */
@@ -268,52 +268,44 @@ namespace c0ding {
[[nodiscard]] std::string get() const; [[nodiscard]] std::string get() const;
/** /**
* Get a part of a given string after a delimiter. * Get the part of the string after {@param delim} (exclusive).
* *
* @param string The given string.
* @param delim The delimiter. * @param delim The delimiter.
* @return The partial string. * @return The partial string.
*/ */
std::string get_from(std::string delim); std::string get_from(std::string delim);
/** /**
* Get a part of a given string before a delimiter. * Get the part of the string before {@param delim} (exclusive).
* *
* @param string The given string.
* @param delim The delimiter. * @param delim The delimiter.
* @return The partial string. * @return The partial string.
*/ */
std::string get_until(std::string delim); std::string get_until(std::string delim);
/** /**
* Replace all targets found in a given string by a replacement. * Replace all occurrences of {@param value} found in the string by {@param replacement} inplace.
* *
* @param string The given string. * @param value The target.
* @param target The target.
* @param replacement The replacement. * @param replacement The replacement.
*/ */
void replace(const std::string& target, const std::string& replacement); void replace(const std::string& value, const std::string& replacement);
/** /**
* Split a given string at a delimiter. * Split the string at {@param delim}.
* *
* @param string The given string.
* @param delim The delimiter. * @param delim The delimiter.
* @return The split parts. * @return The split parts.
*/ */
std::vector<std::string> split(const std::string& delim); std::vector<std::string> split(const std::string& delim);
/** /**
* Transform all characters in a given string to lowercase. * Transform all characters in the string to lowercase.
*
* @param string The given string.
*/ */
void to_lower(); void to_lower();
/** /**
* Transform all characters in a given string to uppercase. * Transform all characters in the string to uppercase.
*
* @param string The given string.
*/ */
void to_upper(); void to_upper();