本文整理汇总了Python中pypy.module.unicodedata.unicodedb.isupper函数的典型用法代码示例。如果您正苦于以下问题:Python isupper函数的具体用法?Python isupper怎么用?Python isupper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isupper函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: descr_isupper
def descr_isupper(self, space):
cased = False
for uchar in self._value:
if unicodedb.islower(ord(uchar)) or unicodedb.istitle(ord(uchar)):
return space.w_False
if not cased and unicodedb.isupper(ord(uchar)):
cased = True
return space.newbool(cased)
示例2: unicode_isupper__Unicode
def unicode_isupper__Unicode(space, w_unicode):
cased = False
for uchar in w_unicode._value:
if unicodedb.islower(ord(uchar)) or unicodedb.istitle(ord(uchar)):
return space.w_False
if not cased and unicodedb.isupper(ord(uchar)):
cased = True
return space.newbool(cased)
示例3: unicode_swapcase__Unicode
def unicode_swapcase__Unicode(space, w_self):
input = w_self._value
builder = UnicodeBuilder(len(input))
for i in range(len(input)):
unichar = ord(input[i])
if unicodedb.islower(unichar):
builder.append(unichr(unicodedb.toupper(unichar)))
elif unicodedb.isupper(unichar):
builder.append(unichr(unicodedb.tolower(unichar)))
else:
builder.append(input[i])
return W_UnicodeObject(builder.build())
示例4: unicode_swapcase__Unicode
def unicode_swapcase__Unicode(space, w_self):
input = w_self._value
result = [u'\0'] * len(input)
for i in range(len(input)):
unichar = ord(input[i])
if unicodedb.islower(unichar):
result[i] = unichr(unicodedb.toupper(unichar))
elif unicodedb.isupper(unichar):
result[i] = unichr(unicodedb.tolower(unichar))
else:
result[i] = input[i]
return W_UnicodeObject(u''.join(result))
示例5: unicode_istitle__Unicode
def unicode_istitle__Unicode(space, w_unicode):
cased = False
previous_is_cased = False
for uchar in w_unicode._value:
if unicodedb.isupper(ord(uchar)) or unicodedb.istitle(ord(uchar)):
if previous_is_cased:
return space.w_False
previous_is_cased = cased = True
elif unicodedb.islower(ord(uchar)):
if not previous_is_cased:
return space.w_False
previous_is_cased = cased = True
else:
previous_is_cased = False
return space.newbool(cased)
示例6: _istitle
def _istitle(self, ch):
return unicodedb.isupper(ord(ch)) or unicodedb.istitle(ord(ch))
示例7: _isupper
def _isupper(self, ch):
return unicodedb.isupper(ord(ch))
示例8: Py_UNICODE_ISUPPER
def Py_UNICODE_ISUPPER(space, ch):
"""Return 1 or 0 depending on whether ch is an uppercase character."""
return unicodedb.isupper(ord(ch))