Remove characters that should not be passed to the lexer.

@param line before cleaning
@return a cleaner line of code
543682
public String cleanLine(final String line) {

        String cleanedLine = extendedCleanLine(line);

        /* Right trim, no need to over burden the lexer with spaces */
        cleanedLine = ("a" + cleanedLine).trim().substring(1);
        return cleanedLine;
    }
716276
private String stripPrefix(final String input, final String searchString) {
        return input.substring(searchString.length(), input.length()).trim();
    }
24802
function removeComments(line) {
	var commentStartIndex = line.indexOf('#');
	if (commentStartIndex > -1) {
		return line.substr(0, commentStartIndex);
	}

	return line;
}
1210963
private String treatContractions(String line) {

    line = noAlphaAposNoAlpha.matcher(line).replaceAll("$1 $2 $3");
    line = noAlphaDigitAposAlpha.matcher(line).replaceAll("$1 $2 $3");
    line = alphaAposNonAlpha.matcher(line).replaceAll("$1 $2 $3");
    if (this.lang.equalsIgnoreCase("en")) {
      line = englishNegations.matcher(line).replaceAll("$1 $2$3");
    }
    line = englishApos.matcher(line).replaceAll("$1 $2$3");
    line = yearApos.matcher(line).replaceAll("$1 $2$3");
    // romance tokenization of apostrophes c' l'
    line = AlphaAposAlpha.matcher(line).replaceAll("$1$2 $3");
    line = endOfSentenceApos.matcher(line).replaceAll("$1 $2");
    line = deTokenEnglishNegation.matcher(line).replaceAll("$1$2$3");
    return line;
  }
1195003
def strip_line(line, sep=os.linesep):
    

    try:
        return line.strip(sep)
    except TypeError:
        return line.decode('utf-8').strip(sep)
463238
public InlineMorph with(String line) {
        if (scriptBuilder.length() == 0) {
            appendBoilerplate(line);
        }
        scriptBuilder
                .append(line)
                .append("\n");
        return this;
    }
1295196
private String cutAfterTab(String line) {
        Pattern p = Pattern.compile("^(.*)\\t.*$");
        Matcher matcher = p.matcher(line);
        if (matcher.matches()) {
            return matcher.group(1);
        } else {
            return line;
        }
    }
137690
def remove_code_or_whole_line(source, line)
      newline_at_end_of_line = source[-1] == "\n"
      source_arr = source.split("\n")
      if source_arr[line - 1] && source_arr[line - 1].strip.empty?
        source_arr.delete_at(line - 1)
        if source_arr[line - 2] && source_arr[line - 2].strip.empty? && source_arr[line - 1] && source_arr[line - 1].strip.empty?
          source_arr.delete_at(line - 1)
        end
        source_arr.join("\n") + (newline_at_end_of_line ? "\n" : '')
      else
        source
      end
    end
494098
def strip_line(line)
      file_format.line_definitions.any? { |_name, definition| definition =~ line } ? line : ''
    end
114286
public static String clean(String path) {

		path = path.replaceAll("//", "/");
		return StringUtils.trimToNull(path);
	}
639356
def __str_cleanup(line):
        
        if '#' in line:
            line = line.replace("#", "")
            line = line.strip()
        if '-----------' in line:
            line = ''
        return line
580024
def _clean_line(self, l):
        ''''''

        new_line = self._sub_ip(l)                  # IP substitution
        new_line = self._sub_hostname(new_line)     # Hostname substitution
        new_line = self._sub_keywords(new_line)     # Keyword Substitution

        return new_line
1320756
public static String cleanup(String sequence) {
    String result = sequence.replaceAll("\\s", ""); // remove all white
    // space
    if (result.equals(result.toLowerCase())) {
      result = result.toUpperCase();
    }
    return result;
  }
1051595
private String stripLineBreaks(String text, String replacement)
   {
      if (text.indexOf('\r') != -1 || text.indexOf('\n') != -1)
      {
         StringBuilder sb = new StringBuilder(text);

         int index;

         while ((index = sb.indexOf("\r\n")) != -1)
         {
            sb.replace(index, index + 2, replacement);
         }

         while ((index = sb.indexOf("\n\r")) != -1)
         {
            sb.replace(index, index + 2, replacement);
         }

         while ((index = sb.indexOf("\r")) != -1)
         {
            sb.replace(index, index + 1, replacement);
         }

         while ((index = sb.indexOf("\n")) != -1)
         {
            sb.replace(index, index + 1, replacement);
         }

         text = sb.toString();
      }

      return (text);
   }
202397
public static String removeUTF8BOM(String line)
    {
        if (line != null && line.startsWith("\uFEFF")) // UTF-8 byte order mark (EF BB BF)
        {
            line = line.substring(1);
        }
        return line;
    }
1218599
private String suffix(final String line) {
        for (int i = 0; i < line.length(); i++) {
            char c = line.charAt(i);
            if (c == ' ' || c == '\t') return line.substring(i + 1);
        }
        return "";
    }
1049178
static public String removeLeadingNewLines(String string) {
    	if (string == null) return string;
    	
    	int pos = 0;
    	int len = string.length();
    	boolean done = false;
    	while (!done) {
    		char c = string.charAt(pos);
    		if (c == '\n' || c == '\r') {
    			pos++;
    		} else {
    			done = true;
    		}

    		if (pos == len) {
    			done = true;
    		}
    	}
    	String result = string.substring(pos);
    	
    	logger.debug("removed " + pos + " new line characters");
    	return result;
    }