mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
cut: Print the entire line if it contains no field delimiters
This commit is contained in:
parent
230a873e0e
commit
bc56d71252
1 changed files with 5 additions and 1 deletions
|
@ -137,8 +137,12 @@ static void process_line_bytes(StringView line, Vector<Range> const& ranges)
|
|||
static void process_line_fields(StringView line, Vector<Range> const& ranges, char delimiter)
|
||||
{
|
||||
auto string_split = DeprecatedString(line).split(delimiter, SplitBehavior::KeepEmpty);
|
||||
Vector<DeprecatedString> output_fields;
|
||||
if (string_split.size() == 1) {
|
||||
outln("{}", line);
|
||||
return;
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> output_fields;
|
||||
for (auto& range : ranges) {
|
||||
for (size_t i = range.m_from - 1; i < min(range.m_to, string_split.size()); i++) {
|
||||
output_fields.append(string_split[i]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue