strmap

sisl.utils.strmap(func, s, sep='b')[source]

Parse a string as though it was a slice and map all entries using func.

Parameters:

func : function

function to parse every match with

s : str

the string that should be parsed

sep : {‘b’, ‘c’}

separator used, 'b' is square brackets, 'c', curly braces

Examples

>>> strmap(int, '1')
[1]
>>> strmap(int, '1-2')
[(1, 2)]
>>> strmap(int, '1-10[2-3]')
[((1, 10), [(2, 3)])]