Extracts a substring spanning from start up to but not-including stop
779828
public static String word_slice(EvaluationContext ctx, Object text, Object start, @IntegerDefault(0) Object stop, @BooleanDefault(false) Object bySpaces) {
        String _text = Conversions.toString(text, ctx);
        int _start = Conversions.toInteger(start, ctx);
        Integer _stop = Conversions.toInteger(stop, ctx);
        boolean _bySpaces = Conversions.toBoolean(bySpaces, ctx);

        if (_start == 0) {
            throw new RuntimeException("Start word cannot be zero");
        } else if (_start > 0) {
            _start -= 1;  // convert to a zero-based offset
        }

        if (_stop == 0) {  // zero is treated as no end
            _stop = null;
        } else if (_stop > 0) {
            _stop -= 1; // convert to a zero-based offset
        }

        List<String> words = getWords(_text, _bySpaces);
        List<String> selection = ExpressionUtils.slice(words, _start, _stop);

        // re-combine selected words with a single space
        return StringUtils.join(selection, ' ');
    }
860387
function __stringStartsWith(str, prefix) {
  // returns true for empty string or null prefix
  if ((!str)) return false;
  if (prefix == "" || prefix == null) return true;
  return str.indexOf(prefix, 0) === 0;
}
1183112
function findLineInRange(sdpLines, startLine, endLine, prefix, substr) {
            var realEndLine = endLine !== -1 ? endLine : sdpLines.length;
            for (var i = startLine; i < realEndLine; ++i) {
                if (sdpLines[i].indexOf(prefix) === 0) {
                    if (!substr ||
                        sdpLines[i].toLowerCase().indexOf(substr.toLowerCase()) !== -1) {
                        return i;
                    }
                }
            }
            return null;
        }
496886
function(str, start) {
    return (str.length >= start.length &&
            str.substr(0, start.length) === start);
  }
1288140
public BinaryString substring(final int start, final int until) {
		ensureMaterialized();
		if (until <= start || start >= sizeInBytes) {
			return EMPTY_UTF8;
		}
		if (inFirstSegment()) {
			MemorySegment segment = segments[0];
			int i = 0;
			int c = 0;
			while (i < sizeInBytes && c < start) {
				i += numBytesForFirstByte(segment.get(i + offset));
				c += 1;
			}

			int j = i;
			while (i < sizeInBytes && c < until) {
				i += numBytesForFirstByte(segment.get(i + offset));
				c += 1;
			}

			if (i > j) {
				byte[] bytes = new byte[i - j];
				segment.get(offset + j, bytes, 0, i - j);
				return fromBytes(bytes);
			} else {
				return EMPTY_UTF8;
			}
		} else {
			return substringSlow(start, until);
		}
	}
919776
static function Part($string, $start, $length = null)
    {
        self::InitEncoding();
        if ($length !== null)
            return mb_substr($string, $start, $length);

        return mb_substr($string, $start);
    }
65293
function extractParts (str, indexA, indexB) {
	let part = str.substr(indexA, indexB);

	part = part.replace(/</g, '&lt;').replace(/>/g, '&gt;');
	part = part.replace(/\n/g, '<span class="invisible"> \u21A9</span>\n');
	part = part.replace(/\t/g, '<span class="invisible tab">\u2192</span>');
	return part;
}
687351
def _mid(string, start, end=None):
    
    if end is None:
        end = len(string)
    return string[start:start + end]
420387
private static String split(String s) {
        int i = s.lastIndexOf('.');
        if (i < 0)
            return s;
        else
            return s.substring(i + 1);
    }
693088
public SubString substring(int start) {
		JcNumber sub = new JcNumber(start, this, OPERATOR.Common.COMMA_SEPARATOR);
		SubString ret = new SubString(null, sub,
				new FunctionInstance(FUNCTION.String.SUBSTRING, 2));
		QueryRecorder.recordInvocationConditional(this, "substring", ret, QueryRecorder.literal(start));
		return ret;
	}
717474
public String substring(int start, int end) {
        int length = end - start;
        if (start > pos || length > pos) {
            throw new IndexOutOfBoundsException();
        }
        return new String(chars, start, length);
    }
1176034
function _substr($string, $start, $length = null) {
        static $mbstring;

        // Cache expensive function_exists() calls.
        if (!isset($mbstring)) {
            $mbstring = function_exists('mb_substr');
        }

        if (is_null($length)) {
            $length = $this->_strlen($string);
        }
        if ($mbstring) {
            $ret = @mb_substr($string, $start, $length, $this->_charset);
            if (!empty($ret)) {
                return $ret;
            }
        }
        return substr($string, $start, $length);
    }
1220086
def _slice(expr, start=None, stop=None, step=None):
    

    return _string_op(expr, Slice, _start=start, _end=stop, _step=step)
42034
function getSubStr(str, pos, len) {
  if (pos < 0 || pos + len > str.length) {
    return "";
  }
  return str.substr(pos, len);
}
245224
function stringEndsWith (str, val, startIndex) {
  var rest = '' + str
  return arguments.length === 1 ? rest.indexOf(val) === rest.length - 1 : rest.substring(0, startIndex).indexOf(val) === startIndex - 1
}
432121
def from_str(self, instr):
        ''''''
        if not instr:
            return FlexiDate()

        out = self.our_re.match(instr)
        if out is None:  # no match TODO: raise Exception?
            return None
        else:
            return FlexiDate(
                out.group('year'),
                out.group('month'),
                out.group('day'),
                out.group('hour'),
                out.group('minute'),
                out.group('second'),
                out.group('microsecond'),
                qualifier=out.group('qualifier')
            )
76353
def parse(s):
    """"""
    stopwatch = StopWatch()
    for line in s.splitlines():
      if line.strip():
        parts = line.split(None)
        name = parts[0]
        if name != "%":  # ie not the header line
          rest = (float(v) for v in parts[2:])
          stopwatch.times[parts[0]].merge(Stat.build(*rest))
    return stopwatch