Split line into coordinates and meta string
962678
def split_line(self):
        
        # coordinate of the # symbol or end of the line (-1) if not found
        hash_or_end = self.line.find("#")
        temp = self.line[self.region_end:hash_or_end].strip(" |")
        self.coord_str = regex_paren.sub("", temp)

        # don't want any meta_str if there is no metadata found
        if hash_or_end >= 0:
            self.meta_str = self.line[hash_or_end:]
        else:
            self.meta_str = ""
674907
def get_line_at(self, coordinates):
        """"""
        cursor = self.cursorForPosition(coordinates)
        cursor.select(QTextCursor.BlockUnderCursor)
        return to_text_string(cursor.selectedText()).replace(u'\u2029', '')
973980
def parse_metadata(lines):
    
    meta = defaultdict(list)
    for line in lines:
        line = line.rstrip()
        if line.startswith("!"):
            if "_table_begin" in line or "_table_end" in line:
                continue
            key, value = __parse_entry(line)
            meta[key].append(value)

    return dict(meta)
800337
def split_line(msg: str) -> Tuple[str, str, List[str]]:
    
    match = RE_IRCLINE.match(msg)
    if not match:
        raise ValueError("Invalid line")

    prefix = match.group("prefix") or ""
    command = match.group("command")
    params = (match.group("params") or "").split()
    message = match.group("message") or ""

    if message:
        params.append(message)

    return prefix, command, params
1154206
function getPos(lines, lineNum, code, indicator) {

	var line, min, max, dots = false, prefix = 0;
	var pos = {};

	// console.log('code', code);

	// handle special cases
	if (code === '{{{{') {
		pos.min = 0;
		pos.max = 4;
		return pos;
	} else if (code === '{{{') {
		pos.min = 0;
		pos.max = 3;
		return pos;
	} else  if (code === '{{') {
		pos.min = 0;
		pos.max = 2;
		return pos;
	} else if (code.indexOf('{{<') !== -1) {
		pos.min = lines[lineNum].indexOf('{{<');
		pos.max = pos.min + 3;
		return pos;
	} else if (code === '{{}}') {
		pos.min = 0;
		pos.max = 4;
		return pos;
	} else if (code.indexOf('{{{}}{') !== -1) {
		pos.min = lines[lineNum].indexOf('{{{}}}');
		pos.max = pos.min + 6;
		return pos;
	} else if (code.indexOf('{{#}}') !== -1) {
		pos.min = lines[lineNum].indexOf('{{#}}');
		pos.max = pos.min + 5;
		return pos;
	}

	// trim off extra prefix and suffix from code which
	// could force us to not find the pos in the line.
	code = code.substring(0, indicator.length);
	code = code.replace('...', function() {
		dots = true;
		return '';
	});

	prefix = code.indexOf('{{');
	line = lines[lineNum];
	min = line.indexOf(code);
	min = min + prefix;
	max = (!dots)
		? min + indicator.length - 1
		: min + indicator.length - 4;

	// todo: if (min === max) max = findMax(line, min); // find first ' ' or '}'
	if (min === max) max++;

	if (min === -1) {
		return {
			min: 0,
			max: 1
		};
	} else {
		return {
			min: min,
			max: max
		};
	}
}
10757
function breakLine (lineOfText, maxLength) {
  const lines = []
  let currText = lineOfText

  while (currText) {
    if (currText.length <= maxLength) {
      lines.push(currText)
      break
    } else {
      let line = ''
      const words = currText.split(/\b/g)
      while (words.length && line.length + words[0].length < maxLength) {
        line += words.shift()
      }
      if (line) lines.push(line.trim())
      currText = words.join('')
    }
  }

  return lines
}
586757
function splitInLines() {
            let legendEntries = svg.selectAll('.legend-entry');
            let numberOfEntries = legendEntries.size();
            let lineHeight = (chartHeight / 2) * 1.7;
            let newLine = svg.select('.legend-group')
              .append('g')
                .classed('legend-line', true)
                .attr('transform', `translate(0, ${lineHeight})`);
            let lastEntry = legendEntries.filter(`:nth-child(${numberOfEntries})`);

            lastEntry.attr('transform', `translate(${markerSize},0)`);
            newLine.append(() => lastEntry.node());
        }
371094
def _cut_line(line):
        
        # punct = '"#$%&\'()*+/<=>?@[\\]^`{|}~'
        if re.search("([\t\n\r]+|[\x0b\x0c ]{3,})+", line):
            tmp = re.split("([\t\n\r]+|[\x0b\x0c ]{3,})+", line, 1)
        else:
            tmp = re.split("[" + string.whitespace + "]+", line, 1)
        res = [elt.strip() for elt in tmp if elt.strip() != '']
        return res
998249
def __split_name_unit(self, line):
        
        vals = []
        unit = ''
        if line != '' or line != ' ':
            # If there are parenthesis, remove them
            line = line.replace('(', '').replace(')', '')
            # When value and units are a range (i.e. '100 m - 200 m').
            if re.match(re_name_unit_range, line):
                m = re.findall(re_name_unit_range, line)
                if m:
                    for group in m:
                        for item in group:
                            try:
                                val = float(item)
                                vals.append(val)
                            except ValueError:
                                if item:
                                    unit = item
                # Piece the number range back together.
                if len(vals) == 1:
                    value = vals[0]
                else:
                    value = str(vals[0]) + ' to ' + str(vals[1])
            else:
                value, unit = self.__name_unit_regex(line)
            return value, unit
362833
def to_fasta_str(self, line_width=50, include_coords=True):
    
    res = ">" + self.name
    if include_coords:
      res += ":" + str(self.start) + "-" + str(self.end)
      res += " (" + str(self.remaining) + ")"
    m_str = self.meta_data_to_string()
    if m_str:
      res += (" " + m_str)
    res += "\n"
    for i in range(0, len(self.sequenceData), line_width):
      res += self.sequenceData[i:i + line_width]
      if i + line_width < len(self.sequenceData):
        res += "\n"
    return res
362987
public static String[] splitString(String line) {
		int len=line.length();
		int wordCount=0;
		int pos=0;
		while(pos<len) {
			// Skip past blank space
			while(pos<len&&line.charAt(pos)<=' ') pos++;
			int start=pos;
			// Skip to the next blank space
			while(pos<len&&line.charAt(pos)>' ') pos++;
			if(pos>start) wordCount++;
		}

		String[] words=new String[wordCount];

		int wordPos=0;
		pos=0;
		while(pos<len) {
			// Skip past blank space
			while(pos<len&&line.charAt(pos)<=' ') pos++;
			int start=pos;
			// Skip to the next blank space
			while(pos<len&&line.charAt(pos)>' ') pos++;
			if(pos>start) words[wordPos++]=line.substring(start,pos);
		}

		return words;
	}
1303091
def SplitMeta(meta):
    
    n = len(meta)
    if n % 2 == 1:
        raise ConfigurationError(
            '%r has an odd number of metacharacters' % meta)
    return meta[:n // 2], meta[n // 2:]
77265
def _parse_line(sep, line):
    
    strs = line.split(sep, 1)
    return (strs[0].strip(), None) if len(strs) == 1 else (strs[0].strip(), strs[1].strip())
1353485
def readWiggleLine(self, line):
        
        if(line.isspace() or line.startswith("#")
                or line.startswith("browser") or line.startswith("track")):
            return
        elif line.startswith("variableStep"):
            self._mode = self._VARIABLE_STEP
            self.parseStep(line)
            return
        elif line.startswith("fixedStep"):
            self._mode = self._FIXED_STEP
            self.parseStep(line)
            return
        elif self._mode is None:
            raise ValueError("Unexpected input line: %s" % line.strip())

        if self._queryReference != self._reference:
            return

        # read data lines
        fields = line.split()
        if self._mode == self._VARIABLE_STEP:
            start = int(fields[0])-1  # to 0-based
            val = float(fields[1])
        else:
            start = self._start
            self._start += self._step
            val = float(fields[0])

        if start < self._queryEnd and start > self._queryStart:
            if self._position is None:
                self._position = start
                self._data.start = start

            # fill gap
            while self._position < start:
                self._data.values.append(float('NaN'))
                self._position += 1
            for _ in xrange(self._span):
                self._data.values.append(val)
            self._position += self._span
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;
        }
852872
def _split_source_page(self, path):
        
        with codecs.open(path, "rb", "utf-8") as fd:
            textlist = fd.readlines()

        metadata_notation = "---\n"
        if textlist[0] != metadata_notation:
            logging.error(
                "{} first line must be triple-dashed!".format(path)
            )
            sys.exit(1)

        metadata_textlist = []
        metadata_end_flag = False
        idx = 1
        max_idx = len(textlist)
        # TODO(crow): BE PYTHONIC!!!
        while not metadata_end_flag:
            metadata_textlist.append(textlist[idx])
            idx += 1
            if idx >= max_idx:
                logging.error(
                    "{} doesn't have end triple-dashed!".format(path)
                )
                sys.exit(1)
            if textlist[idx] == metadata_notation:
                metadata_end_flag = True
        content = textlist[idx + 1:]

        return metadata_textlist, content
248407
def extract_meta(self, text):
        
        first_line = True
        metadata = []
        content = []
        metadata_parsed = False

        for line in text.split('\n'):
            if first_line:
                first_line = False
                if line.strip() != '---':
                    raise MetaParseException('Invalid metadata')
                else:
                    continue
            if line.strip() == '' and not metadata_parsed:
                continue
            if line.strip() == '---' and not metadata_parsed:
                # reached the last line
                metadata_parsed = True
            elif not metadata_parsed:
                metadata.append(line)
            else:
                content.append(line)

        content = '\n'.join(content)
        try:
            metadata = yaml.load('\n'.join(metadata))
        except:
            raise
            content = text
            metadata = yaml.load('')

        return content, metadata