Tools for parsing strings and extracting certain types of information.
Find a matching parenthesis in an expression.
| Parameters : | expression : str
start : int
|
|---|---|
| Returns : | int :
|
Examples
>>> findClosingParenthesis("3 + @(cat) + @(dog)", 6)
9
Extract the names of bins which begin with a given character.
| Parameters : | expression : str
marker : str
|
|---|---|
| Returns : | list of str :
|
Examples
>>> extractNamesOfType("3 + @(cat)*$(fish) + @(dog)/#(mouse)", "@")
['cat', 'dog']
Extract the names of all data bins in some expression.
| Parameters : | expression : str
|
|---|---|
| Returns : | tuple of list of str :
|
Examples
>>> extractNames("3 + @(cat) + @(dog)")
(['cat', 'dog'], [], [])
>>> extractNames("3 + @(cat)*$(fish) + @(dog)/#(mouse)")
(['cat', 'dog'], ['mouse'], ['fish'])
Split the string at the specified delimiter.
This function works similar to the built-in string function split except that it takes into account the possibility that the delimiter occurs inside some grouping construction (for example, quotation marks or list brackets) which should prevent splitting.
| Parameters : | string : str
delimiter : str
|
|---|---|
| Returns : | list of str :
str :
|