Skip to content

Commit b2b0338

Browse files
DOC: Add examples for np.strings.startswith()
[skip azp] [skip cirrus]
1 parent be75bec commit b2b0338

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

numpy/_core/strings.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,17 @@ def startswith(a, prefix, start=0, end=None):
428428
--------
429429
str.startswith
430430
431+
Examples
432+
--------
433+
>>> import numpy as np
434+
>>> s = np.array(['foo', 'bar'])
435+
>>> s
436+
array(['foo', 'bar'], dtype='<U3')
437+
>>> np.strings.startswith(s, 'fo')
438+
array([True, False])
439+
>>> np.strings.startswith(s, 'o', start=1, end=2)
440+
array([True, False])
441+
431442
"""
432443
end = end if end is not None else MAX
433444
return _startswith_ufunc(a, prefix, start, end)

0 commit comments

Comments
 (0)