Skip to content

Commit 208ff34

Browse files
committed
docs: Add a comment for extract_alphanumeric
1 parent fcbec33 commit 208ff34

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/basic/string.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def extract_alphanumeric(s: str) -> str:
3838
>>> extract_alphanumeric("こんにちは123ABCワールド")
3939
'123ABC'
4040
"""
41+
# isalnum() alone would include Unicode alphanumeric characters (like '12345' or 'ABCDE')
4142
# isascii() ensures we only get ASCII characters (0-127),
4243
# excluding Unicode characters like Japanese, Emoji, etc.
4344
return "".join(c for c in s if c.isascii() and c.isalnum())

0 commit comments

Comments
 (0)