|
2 | 2 | # Apache License 2.0, Copyright 2019 Tebel.Automation Private Limited |
3 | 3 | # https://github.com/tebelorg/RPA-Python/blob/master/LICENSE.txt |
4 | 4 | __author__ = 'Ken Soh <[email protected]>' |
5 | | -__version__ = '1.42.0' |
| 5 | +__version__ = '1.43.0' |
6 | 6 |
|
7 | 7 | import subprocess |
8 | 8 | import os |
@@ -1734,3 +1734,35 @@ def download_location(location = None): |
1734 | 1734 | else: |
1735 | 1735 | _tagui_download_directory = location |
1736 | 1736 | return True |
| 1737 | + |
| 1738 | +def get_text(source_text = None, left = None, right = None, count = 1): |
| 1739 | + if source_text is None or left is None or right is None: |
| 1740 | + return '' |
| 1741 | + |
| 1742 | + left_position = source_text.find(left) |
| 1743 | + if left_position == -1: return '' |
| 1744 | + right_position = source_text.find(right, left_position + 1) |
| 1745 | + if right_position == -1: return '' |
| 1746 | + |
| 1747 | + if count > 1: |
| 1748 | + occurrence_count = 2 |
| 1749 | + while occurrence_count <= count: |
| 1750 | + occurrence_count += 1 |
| 1751 | + left_position = source_text.find(left, right_position + 1) |
| 1752 | + if left_position == -1: return '' |
| 1753 | + right_position = source_text.find(right, left_position + 1) |
| 1754 | + if right_position == -1: return '' |
| 1755 | + |
| 1756 | + return source_text[left_position + len(left) : right_position].strip() |
| 1757 | + |
| 1758 | +def del_chars(source_text = None, characters = None): |
| 1759 | + if source_text is None: |
| 1760 | + return '' |
| 1761 | + |
| 1762 | + elif characters is None: |
| 1763 | + return source_text |
| 1764 | + |
| 1765 | + for character in characters: |
| 1766 | + source_text = source_text.replace(character, '') |
| 1767 | + |
| 1768 | + return source_text |
0 commit comments