Path: blob/main/python/pylang/src/lib/pythonize.py
1398 views
# vim:fileencoding=utf-81# License: BSD Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>2# globals: ρσ_str345def strings():6string_funcs = set((7'capitalize strip lstrip rstrip islower isupper isspace lower upper swapcase'8' center count endswith startswith find rfind index rindex format join ljust rjust'9' partition rpartition replace split rsplit splitlines zfill'10).split(' '))1112if not arguments.length:13exclude = {'split', 'replace'}14elif arguments[0]:15exclude = Array.prototype.slice.call(arguments)16else:17exclude = None18if exclude:19string_funcs = string_funcs.difference(set(exclude))20for name in string_funcs:21String.prototype[name] = ρσ_str.prototype[name]222324