Skip to content

Commit d617dec

Browse files
committed
#259 - add get_text() & del_chars()
1 parent 690b251 commit d617dec

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

rpa_package/rpa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Apache License 2.0, Copyright 2019 Tebel.Automation Private Limited
33
# https://github.com/tebelorg/RPA-Python/blob/master/LICENSE.txt
44
__author__ = 'Ken Soh <[email protected]>'
5-
__version__ = '1.42.0'
5+
__version__ = '1.43.0'
66

77
# for backward compatibility, invoke tagui.py functions to use in rpa.py
88
from tagui import *

rpa_package/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
setup(
44
name='rpa',
5-
version='1.42.0',
6-
py_modules=['rpa'], install_requires=['tagui>=1.42.0'],
5+
version='1.43.0',
6+
py_modules=['rpa'], install_requires=['tagui>=1.43.0'],
77
author='Ken Soh',
88
author_email='[email protected]',
99
license='Apache License 2.0',

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='tagui',
5-
version='1.42.0',
5+
version='1.43.0',
66
py_modules=['tagui'],
77
author='Ken Soh',
88
author_email='[email protected]',

tagui.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Apache License 2.0, Copyright 2019 Tebel.Automation Private Limited
33
# https://github.com/tebelorg/RPA-Python/blob/master/LICENSE.txt
44
__author__ = 'Ken Soh <[email protected]>'
5-
__version__ = '1.42.0'
5+
__version__ = '1.43.0'
66

77
import subprocess
88
import os
@@ -1734,3 +1734,35 @@ def download_location(location = None):
17341734
else:
17351735
_tagui_download_directory = location
17361736
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

Comments
 (0)