Skip to content

Rose::StringUtility::removeRedundantSubstrings

Remove redundant and blank lines.

Synopsis

Declared in <src/Rose/StringUtility/Convert.h>

[[visibility]]
std::string
removeRedundantSubstrings(std::string const&);

Description

Splits the input string into substrings according to listToString, sorts the substrings and removes duplicates and lines that are empty (a line of only horizontal white space is not considered to be empty), then concatenates the substrings in their sorted order into the return value using listToString, inserting extra white space at the beginning of all but the first line.

The original implementation had a bug (ROSE‐304) that caused the first substring to be removed from the return value even if it was non‐empty and unique. This happened when it was not followed by a line‐feed.

Return Value

Normalized string.

Created with MrDocs