Skip to content

SliceFilter::doFilter does not work with ranges #30

@textshell

Description

@textshell

SliceFilter::doFilter tries splits the input into parts left and right from the ":" that divides the range to output.

  auto splitterIndex = argString.get().indexOf(QLatin1Char(':'));
  QString inputString = getSafeString(input);
  if (splitterIndex >= 0) {
    auto left = argString.get().left(splitterIndex).get().toInt();
    auto right = argString.get().right(splitterIndex).get().toInt();

But the right hand part is not correctly extracted, because QString::right expects the amount of characters from the right. It seems the code should be using QString::mid with the correct index adjustments instead.

Test cases:
data|slice:"0:10" returns the empty string, because it uses only "0" as right side.
data|slice:"00:-1" works because because "00" and "-1" are the same lenght.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions