Skip to content

Rose::StringUtility::makeOneLine

Converts a multi-line string to a single line.

Synopsis

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

[[visibility("default")]]
std::string
makeOneLine(
    std::string const& s,
    std::string replacement = " ");

Description

This function converts a multi-line string to a single line by replacing line-feeds and carriage-returns (and their surrounding white space) with a user-supplied replacement string (that defaults to a single space). Line termination (and it's surrounding white space) that appears at the front or back of the input string is removed without replacing it.

See roseTests/utilTests/stringTests.C for lots of examples.

Return Value

Single-line string.

Parameters

Name Description
s Input string.
replacement Replacement string for line breaks.

Created with MrDocs