MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / sequential_rep

Function sequential_rep

utils/strfunctions.py:7–21  ·  view source on GitHub ↗

:param text_: string content :param args: like , , , , ... :return: if text_ length was zero or invalid parameters then no manipulation to text_

(text_, *args)

Source from the content-addressed store, hash-verified

5
6
7def sequential_rep(text_, *args):
8 # type: (basestring, tuple) -> basestring
9 """
10 :param text_: string content
11 :param args: like <pattern>, <replacement>, <pattern>, <replacement>, ...
12 :return: if text_ length was zero or invalid parameters then no manipulation to text_
13 """
14 arg_len = len(args)
15 if arg_len % 2 == 0 and isinstance(text_, str) and len(text_) > 0:
16 i = 0
17 while i < arg_len:
18 text_ = re.sub(args[i], args[i + 1], text_)
19 i += 2
20
21 return text_
22
23
24def replace_ltgt(text_):

Callers 1

importXmlFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected