MCPcopy Index your code
hub / github.com/plotly/plotly.py / split_multichar

Function split_multichar

_plotly_utils/utils.py:393–410  ·  view source on GitHub ↗

Split all the strings in ss at any of the characters in chars. Example: >>> ss = ["a.string[0].with_separators"] >>> chars = list(".[]_") >>> split_multichar(ss, chars) ['a', 'string', '0', '', 'with', 'separators'] :param (list) ss: A list of strings.

(ss, chars)

Source from the content-addressed store, hash-verified

391
392
393def split_multichar(ss, chars):
394 """
395 Split all the strings in ss at any of the characters in chars.
396 Example:
397
398 >>> ss = ["a.string[0].with_separators"]
399 >>> chars = list(".[]_")
400 >>> split_multichar(ss, chars)
401 ['a', 'string', '0', '', 'with', 'separators']
402
403 :param (list) ss: A list of strings.
404 :param (list) chars: Is a list of chars (note: not a string).
405 """
406 if len(chars) == 0:
407 return ss
408 c = chars.pop()
409 ss = reduce(lambda x, y: x + y, map(lambda x: x.split(c), ss))
410 return split_multichar(ss, chars)
411
412
413def split_string_positions(ss):

Callers 2

_str_to_dict_path_fullFunction · 0.90
_split_and_chompFunction · 0.90

Calls 2

popMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected