Converts \r\n, \r, and \n to <br>s
@param {*} str The string in which to convert newlines.
@param {boolean=} opt_xml Whether to use XML compatible tags.
@return {string} A copy of {@code str} with converted newlines.
769626
function(str, opt_xml) {

      str = String(str);

      // This quick test helps in the case when there are no chars to replace,
      // in the worst case this makes barely a difference to the time taken.
      if (!goog.string.NEWLINE_TO_BR_RE_.test(str)) {
        return str;
      }

      return str.replace(/(\r\n|\r|\n)/g, opt_xml ? '<br />' : '<br>');
    }
904259
def xml_decode(string):
    
    string = string.replace("&amp;", "&")
    string = string.replace("&lt;",  "<")
    string = string.replace("&gt;",  ">")
    string = string.replace("&quot;","\"")
    string = string.replace("/", SLASH)
    return string
875374
function split_newlines(s) {
            //return s.split(/\x0d\x0a|\x0a/);

            s = s.replace(/\x0d/g, '');
            var out = [],
                idx = s.indexOf("\n");
            while (idx !== -1) {
                out.push(s.substring(0, idx));
                s = s.substring(idx + 1);
                idx = s.indexOf("\n");
            }
            if (s.length) {
                out.push(s);
            }
            return out;
        }
301254
function Parser(html, opts) {
        // fake root node
        html = util.trim(html);
        this.originalHTML = html;    // only allow condition
                                     // 1. start with <!doctype
                                     // 2. start with <!html
                                     // 3. start with <!body
                                     // 4. not start with <head
                                     // 5. not start with <meta
        // only allow condition
        // 1. start with <!doctype
        // 2. start with <!html
        // 3. start with <!body
        // 4. not start with <head
        // 5. not start with <meta
        if (/^(<!doctype|<html|<body)/i.test(html)) {
            html = '<document>' + html + '</document>';
        } else {
            html = '<body>' + html + '</body>';
        }
        this.lexer = new Lexer(html);
        this.opts = opts || {};
    }
620329
function(str){
	var retstr = str;

	if( ! us.isUndefined(str) && str.length > 2 ){
	    var end = str.length -1;
	    if( str.charAt(0) == '"' && str.charAt(end) == '"' ){
		retstr = str.substr(1, end -1);
	    }
	}

	return retstr;
    }
1118045
public static function parse($str, $opts = array())
	{
		$params = array();
		$opts = \array_merge(
			array(
				'conv_dot'		=> false,
				'conv_space'	=> true,
			),
			$opts
		);
		if (( $opts['conv_dot'] || \strpos($str, '.') === false )
			&& ( $opts['conv_space'] || \strpos($str, ' ') === false )
		) {
			// just use parse_str
			\parse_str($str, $params);
		} else {
			$pairs = \explode('&', $str);
			foreach ($pairs as $pair) {
				$ptr = &$params;
				$pair = \array_map('urldecode', \explode('=', $pair));
				$path = $pair[0];
				$v = isset($pair[1])
					? $pair[1]
					: '';
				$i = 0;
				$re = '/^([^\[]*)/';
				while (\preg_match($re, $path, $matches)) {
					$k = $matches[1];
					$a = \preg_match('/^\s?$/', $k);		// 0 or 1 whitepace = append
					if ($i == 0) {
						// ltrim spaces as parse_str() does
						$k = \ltrim($k, ' ');
						if (\strlen($k) == 0) {
							break;
						}
						if ($opts['conv_space']) {
							$k = \str_replace(' ', '_', $k);
						}
						$re = '/^\[([^\]]*?)\](\s*)/';	// change regex
					} elseif (!empty($matches[2])) {
						$path = '';	// space on the end... this is the end of the path
					}
					$path = \substr($path, \strlen($matches[0]));	// remaining path
					if ($path !== false) {
						if ($a) {
							$ptr[] = array();
							\end($ptr);
							$k = \key($ptr);
						} elseif (!isset($ptr[ $k ]) || \is_string($ptr[ $k ])) {
							$ptr[ $k ] = array();
						}
						$ptr = &$ptr[$k];
					} else {
						if ($a) {
							$ptr[] = $v;
						} else {
							$ptr[ $k ] = $v;
						}
						break;
					}
					$i++;
				}
				if (!empty($path)) {
					// still have remaining path... there were unmatched brackets
					$ptr = $v;
				}
			}
		}
		return $params;
	}
799901
public static List<String> split(
                    final String str
                    )
    {
        String  s = str;
        if (s != null) {
            s = s.trim();
        }

        List<String>  list = new ArrayList<String>();
        if (s == null || s.length() == 0) {
            return list;
        }

        String[]  tokens = s.split( "[ \t\n\r\f]" );
        // NOTE: tokens[i] may be an empty string "".

        // excludes empty strings.
        int  n_tokens = tokens.length;
        for (int  i = 0; i < n_tokens; i++) {
            if (tokens[i].length() > 0) {
                list.add( tokens[i] );
            }
        }

        return list;
    }
1248131
@SuppressWarnings("ReturnOfNull")
    public static Option strToOpt(final String optStr) {
        final String[] parts = SPACE.split(optStr, 2);
        final String name = parts[0];
        final String param = 1 < parts.length ? parts[1] : null;

        final Option opt = OPTS.get(name);
        return opt == null ? null : opt.newInstance(param);
    }
918478
public static String opToStr(Token operator) {
    switch (operator) {
      case BITOR:
        return "|";
      case OR:
        return "||";
      case BITXOR:
        return "^";
      case AND:
        return "&&";
      case BITAND:
        return "&";
      case SHEQ:
        return "===";
      case EQ:
        return "==";
      case NOT:
        return "!";
      case NE:
        return "!=";
      case SHNE:
        return "!==";
      case LSH:
        return "<<";
      case IN:
        return "in";
      case LE:
        return "<=";
      case LT:
        return "<";
      case URSH:
        return ">>>";
      case RSH:
        return ">>";
      case GE:
        return ">=";
      case GT:
        return ">";
      case MUL:
        return "*";
      case DIV:
        return "/";
      case MOD:
        return "%";
      case EXPONENT:
        return "**";
      case BITNOT:
        return "~";
      case ADD:
      case POS:
        return "+";
      case SUB:
      case NEG:
        return "-";
      case ASSIGN:
        return "=";
      case ASSIGN_BITOR:
        return "|=";
      case ASSIGN_BITXOR:
        return "^=";
      case ASSIGN_BITAND:
        return "&=";
      case ASSIGN_LSH:
        return "<<=";
      case ASSIGN_RSH:
        return ">>=";
      case ASSIGN_URSH:
        return ">>>=";
      case ASSIGN_ADD:
        return "+=";
      case ASSIGN_SUB:
        return "-=";
      case ASSIGN_MUL:
        return "*=";
      case ASSIGN_EXPONENT:
        return "**=";
      case ASSIGN_DIV:
        return "/=";
      case ASSIGN_MOD:
        return "%=";
      case VOID:
        return "void";
      case TYPEOF:
        return "typeof";
      case INSTANCEOF:
        return "instanceof";
      default:
        return null;
    }
  }
673973
function Parser(str, opts) {
  this._oneWayVoid = !!(opts && opts.oneWayVoid);
  this._reassignJavadoc = !!(opts && opts.reassignJavadoc);
  this._imports = [];
  this._tk = new Tokenizer(str);
  this._tk.next(); // Prime tokenizer.
}
1003219
def to_xml_string(str = '')
      super(str) do
        # needs to override the super color here to push in ln/and something else!
        if color
          str << '<c:spPr><a:solidFill>'
          str << ('<a:srgbClr val="' << color << '"/>')
          str << '</a:solidFill>'
          str << '<a:ln><a:solidFill>'
          str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>')
          str << '</c:spPr>'
        end
        @xData.to_xml_string(str) unless @xData.nil?
        @yData.to_xml_string(str) unless @yData.nil?
        @bubbleSize.to_xml_string(str) unless @bubbleSize.nil?
      end
      str
    end
1184311
def to_xml_string(str = '')
      return if empty?
      str << '<protectedRanges>'
      each { |range| range.to_xml_string(str) }
      str << '</protectedRanges>'
    end
208897
private static String decode(final String str) {
        if (str == null) {
            return null;
        }

        for (int i = 0; i < str.length(); ++i) {
            if (str.charAt(i) == '%') {
                return decode(str, i);
            }
        }

        return str;
    }
231371
def to_xml_string(str = '')
      str << '<c:serAx>'
      super(str)
      str << ('<c:tickLblSkip val="' << @tick_lbl_skip.to_s << '"/>') unless @tick_lbl_skip.nil?
      str << ('<c:tickMarkSkip val="' << @tick_mark_skip.to_s << '"/>') unless @tick_mark_skip.nil?
      str << '</c:serAx>'
    end
1145576
def prettify_xml(xml_str):
    
    parsed_xml = parseString(get_string(xml_str))
    pretty_xml = '\n'.join(
        [line for line in parsed_xml.toprettyxml(indent=' ' * 2)
         .split('\n') if line.strip()])
    if not pretty_xml.endswith('\n'):
        pretty_xml += '\n'
    return pretty_xml
611909
function parse_RString(blob, length, opts) {
	var end = blob.l + length;
	var cell = parse_XLSCell(blob, 6);
	var cch = blob.read_shift(2);
	var str = parse_XLUnicodeStringNoCch(blob, cch, opts);
	blob.l = end;
	cell.t = 'str';
	cell.val = str;
	return cell;
}
818185
function wrapNode (node, opts) {
            var wrapper = document.createElement(opts.tag);

            /* Assign the element a class of "blast". */
            wrapper.className = NAME;

            /* If a custom class was provided, assign that too. */
            if (opts.customClass) {
                wrapper.className += " " + opts.customClass;

                /* If an opts.customClass is provided, generate an ID consisting of customClass and a number indicating the match's iteration. */
                if (opts.generateIndexID) {
                    wrapper.id = opts.customClass + "-" + Element.blastedIndex;
                }
            }

            /* For the "all" delimiter, prevent space characters from collapsing. */
            if (opts.delimiter === "all" && /\s/.test(node.data)) {
                wrapper.style.whiteSpace = "pre-line";
            }

            /* Assign the element a class equal to its escaped inner text. Only applicable to the character and word delimiters (since they do not contain spaces). */
            if (opts.generateValueClass === true && !opts.search && (opts.delimiter === "character" || opts.delimiter === "word")) {
                var valueClass,
                    text = node.data;

                /* For the word delimiter, remove adjoined punctuation, which is unlikely to be desired as part of the match -- unless the text
                   consists solely of punctuation (e.g. "!!!"), in which case we leave the text as-is. */
                if (opts.delimiter === "word" && Reg.onlyContainsPunctuation.test(text)) {
                    /* E: Remove punctuation that's adjoined to either side of the word match. */
                    text = text.replace(Reg.adjoinedPunctuation, "");
                }

                valueClass = NAME + "-" + opts.delimiter.toLowerCase() + "-" + text.toLowerCase();

                wrapper.className += " " + valueClass;
            }

            /* Hide the wrapper elements from screenreaders now that we've set the target's aria-label attribute. */
            if (opts.aria) {
                wrapper.setAttribute("aria-hidden", "true");
            }

            wrapper.appendChild(node.cloneNode(false));

            return wrapper;
        }