Skip to content

Commit 35327ed

Browse files
committedJun 8, 2022
add escape string
1 parent 2ac8be2 commit 35327ed

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎convex_api/contract.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,13 @@ def owner_address(self):
177177
@property
178178
def name(self):
179179
return self._name
180+
181+
@staticmethod
182+
def escape_string(text):
183+
"""
184+
Escape any string and replace quote chars with leading escape chars
185+
186+
"""
187+
escape_text = re.sub('\\\\', '\\\\\\\\', text)
188+
escape_text = re.sub('"', '\\"', escape_text)
189+
return escape_text

0 commit comments

Comments
 (0)