Check the prefix of a string.

Share:

Description

Return TRUE if the string str starts with the specified prefix, otherwise return FALSE.

Usage

1
pystr_startswith(str, prefix, start = 1, end = nchar(str))

Arguments

str

A character vector.

prefix

A character vector.

start

A numeric vector.

end

A numeric vector.

Details

With optional start, test string beginning at that position. With optional end, stop comparing string at that position.

Value

A logical vector.

References

https://docs.python.org/3/library/stdtypes.html#str.startswith

See Also

pystr_endswith

Examples

1
2
3
pystr_startswith("www.example.com", "www.")
pystr_startswith("example.com", "www.")
pystr_startswith("www.example.com", "example", 5)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.