X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=string_utils.py;h=a2f46332156e0c5fc41f3db8a8228a149272651c;hb=47ece7bceb442d70ddcc3c728533c4d4d2bccde4;hp=08995765411a22bf5272bdae4bdee41b20312bc0;hpb=c6fca944b41f292b66efaba27ebf3fd0a37956b8;p=python_utils.git diff --git a/string_utils.py b/string_utils.py index 0899576..a2f4633 100644 --- a/string_utils.py +++ b/string_utils.py @@ -857,6 +857,10 @@ def words_count(in_str: str) -> int: return len(WORDS_COUNT_RE.findall(in_str)) +def word_count(in_str: str) -> int: + return words_count(in_str) + + def generate_uuid(omit_dashes: bool = False) -> str: """ Generated an UUID string (using `uuid.uuid4()`). @@ -876,7 +880,9 @@ def generate_random_alphanumeric_string(size: int) -> str: Returns a string of the specified size containing random characters (uppercase/lowercase ascii letters and digits). - random_string(9) # possible output: "cx3QQbzYg" + >>> random.seed(22) + >>> generate_random_alphanumeric_string(9) + '96ipbNClS' """ if size < 1: