Removes trailing empty lines.
510025
public void removeTrailingEmptyLines ()
  {
    Line aLine = m_aLineTail;
    while (aLine != null && aLine.m_bIsEmpty)
    {
      removeLine (aLine);
      aLine = m_aLineTail;
    }
  }
503902
public boolean removeLeadingEmptyLines()
    {
        boolean wasEmpty = false;
        Line line = this.lines;
        while (line != null && line.isEmpty)
        {
            this.removeLine(line);
            line = this.lines;
            wasEmpty = true;
        }
        return wasEmpty;
    }
565205
def clean_text(s):
    """"""
    SPACES_RE = re.compile(r'\s+')
    SPECIAL_CHARS_RE = re.compile(r'[^\w\s\.\-\(\)]')
    s = SPACES_RE.sub(' ', s)
    s = s.strip()
    s = SPECIAL_CHARS_RE.sub('', s)
    return s
483887
def removeblanklines(astr):
    """"""
    lines = astr.splitlines()
    lines = [line for line in lines if line.strip() != ""]
    return "\n".join(lines)
1256857
private static String removeLeadingZeros(String generated) {
        StringBuilder builder = new StringBuilder();
        boolean leading = true;
        for (int i = 0; i < generated.length(); i++) {
            if (generated.charAt(i) == '0' && leading) {
                continue;
            } else {
                leading = false;
                builder.append(generated.charAt(i));
            }
        }
        
        if (builder.length() == 0) {
            // very unlikely to happen, ensures that empty string is not returned
            builder.append('0');
        }
        
        return builder.toString();
    }
32740
def remove_empty_text(utterances: List[Utterance]) -> List[Utterance]:
    
    return [utter for utter in utterances if utter.text.strip() != ""]
1084937
public void removeTrailingWhitespaces()
    {
        int last = -1;
        for (int i = text.length() - 1; i >= 0; i--)
        {
            if (isWhitespace(text.charAt(i)))
                last = i;
            else
                break;
        }
        if (last != -1)
        {
            text = text.substring(0, last);
            textStart = 0;
            textEnd = last;
        }
    }
1155211
def empty_line_count_at_the_end(self):
        
        count = 0
        for line in self.lines[::-1]:
            if not line or line.isspace():
                count += 1
            else:
                break

        return count
403153
function trimLeadingLineBreaks(node) {
          do {
            if (node.nodeType === 3) {
              node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, '');
            }

            node = node.firstChild;
          } while (node);
        }
893676
def fix_line_breaks(s):
    
    l = s.splitlines()
    x = [i.strip() for i in l]
    x = [i for i in x if i]  # remove blank lines
    return "\n".join(x)
1051847
def remove_trailing_white_spaces(self):
        

        cursor = self.textCursor()

        block = self.document().findBlockByLineNumber(0)
        while block.isValid():
            cursor.setPosition(block.position())
            if re.search(r"\s+$", block.text()):
                cursor.movePosition(QTextCursor.EndOfBlock)
                cursor.movePosition(QTextCursor.StartOfBlock, QTextCursor.KeepAnchor)
                cursor.insertText(foundations.strings.to_string(block.text()).rstrip())
            block = block.next()
        cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor)
        if not cursor.block().text().isEmpty():
            cursor.insertText("\n")
        return True
741796
function trimTrailing(text, postfix) {
        if (text && postfix) {
            if (_.endsWith(text, postfix)) {
                return text.substring(0, text.length - postfix.length);
            }
        }
        return text;
    }
849452
def _no_trailing_whitespace(relative_path, contents, linter_options):
    """
    del relative_path
    del linter_options

    trailing_whitespace = re.compile(r"(?<![ \t\r\n])[ \t]+$")

    for index, line in enumerate(contents):
        for space in trailing_whitespace.finditer(line):
            assert space.end() == len(line) - 1
            return LinterFailure("Trailing whitespace",
                                 index + 1,
                                 line[:space.start()] + line[space.end():])
977395
def split_trailing_indent(line, max_indents=None):
    """"""
    indent = ""
    while (
        (max_indents is None or max_indents > 0)
        and line.endswith((openindent, closeindent))
    ) or line.rstrip() != line:
        if max_indents is not None and (line.endswith(openindent) or line.endswith(closeindent)):
            max_indents -= 1
        indent = line[-1] + indent
        line = line[:-1]
    return line, indent
1293501
def _strip_trailing_zeros(value):
        
        return list(
           reversed(
              list(itertools.dropwhile(lambda x: x == 0, reversed(value)))
           )
        )
502
public String cleanFixedLine(final String line) {

        StringBuilder cleanedLine = new StringBuilder();
        int length = line.length();

        /* Clear sequence numbering */
        for (int i = 0; i < _startColumn - 1; i++) {
            cleanedLine.append(" ");
        }

        /* Trim anything beyond end column */
        if (length > _startColumn - 1) {
            String areaA = line.substring(_startColumn - 1,
                    (length > _endColumn) ? _endColumn : length);

            cleanedLine.append(areaA);
        }
        return cleanedLine.toString();
    }
492124
private Iterator<String> filterOutEmptyStrings(final Iterator<String> splitted) {
        return new Iterator<String>() {
            String next = getNext();
            @Override
            public boolean hasNext() {
                return next != null;
            }

            @Override
            public String next() {
                if ( !hasNext() ) throw new NoSuchElementException();
                String result = next;
                next = getNext();
                return result;
            }

            public String getNext() {
                while (splitted.hasNext()) {
                    String value = splitted.next();
                    if ( value != null && !value.isEmpty() ) {
                        return value;
                    }
                }
                return null;
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }