Skip to content

Commit 7d8de93

Browse files
committed
DOC: add char.startswith example
[skip actions][skip azp][skip cirrus]
1 parent 256f702 commit 7d8de93

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

numpy/_core/strings.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,16 @@ def startswith(a, prefix, start=0, end=None):
421421
--------
422422
str.startswith
423423
424+
Examples
425+
--------
426+
>>> s = np.array(['foo', 'bar'])
427+
>>> s
428+
array(['foo', 'bar'], dtype='<U3')
429+
>>> np.strings.startswith(s, 'ba')
430+
array([False, True])
431+
>>> np.strings.startswith(s, 'a', start=1, end=2)
432+
array([False, True])
433+
424434
"""
425435
end = end if end is not None else MAX
426436
return _startswith_ufunc(a, prefix, start, end)

0 commit comments

Comments
 (0)