Learn R Programming

pystr (version 2.0.0)

pystr_startswith: Check the prefix of a string.

Description

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

Usage

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.

Value

A logical vector.

Details

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

References

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

See Also

pystr_endswith

Examples

Run this code
pystr_startswith("www.example.com", "www.")
pystr_startswith("example.com", "www.")
pystr_startswith("www.example.com", "example", 5)

Run the code above in your browser using DataLab