I have the following template std::string
std::string myString = R"svg(
<svg height={size} width={size}>
<rect {...rectProps} x={x0h} y={y0h} />
// <rect {...rectProps} x={x1h} y={y0h} />
<rect {...rectProps} x={x0h} y={y1h} />
// <rect {...rectProps} x={x1h} y={y1h} />
</svg>
)svg";
And I will like to remove every line that starts with //
So the result I want will be like this
<svg height={size} width={size}>
<rect {...rectProps} x={x0h} y={y0h} />
<rect {...rectProps} x={x0h} y={y1h} />
</svg>
Edit: So my idea now is to iterate each line, trim it, and then detect if it starts with "//"
So far I have this in pseudo
std::istringstream stream(myString);
std::string line;
std::string myFinalString;
while (std::getline(stream, line)) {
// TODO: trim line first
bool isComment = false; // Find here if the line starts with //
if (!isComment) {
myFinalString += line + "
";
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…