Length of each string in a NumPy array : <p>Is there any builtin operation in NumPy that returns the length of each string in an array?</p>

<p>I don't think any of the <a href="https://docs.scipy.org/doc/numpy-1.12.0/reference/routines.char.html" rel="noreferrer">NumPy string operations</a> does that, is this correct?</p>

<p>I can do it with a <code>for</code> loop, but maybe there's something more efficient?</p>

<pre><code>import numpy as np
arr = np.array(['Hello', 'foo', 'and', 'whatsoever'], dtype='S256')

sizes = []
for i in arr:
    sizes.append(len(i))

print(sizes)
[5, 3, 3, 10]
</code></pre>
