Skip to content

Commit

Permalink
Add has_any_letters definition
Browse files Browse the repository at this point in the history
To be used while analysing text content.
  • Loading branch information
uluQulu committed Nov 13, 2018
1 parent 36f4e51 commit bfb0dad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions instapy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1569,3 +1569,13 @@ def truncate_float(number, precision, round=False):


return short_float

def has_any_letters(text):
""" Check if the text has any letters in it """
#result = re.search("[A-Za-z]", text) # works only with english letters
result = any(c.isalpha() for c in text) # works with any letters - english or non-english

return result



0 comments on commit bfb0dad

Please sign in to comment.