本文整理汇总了Python中external_strings_utils.truncate_utf8函数的典型用法代码示例。如果您正苦于以下问题:Python truncate_utf8函数的具体用法?Python truncate_utf8怎么用?Python truncate_utf8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了truncate_utf8函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: packPascalString
def packPascalString(s):
if isinstance(s, unicode):
s = s.encode('utf8')
s = truncate_utf8(s, MAX_PASCAL_STRING_LEN)
buffer = struct.pack('<H', len(s))
buffer += s
return buffer
示例2: __init__
def __init__(self, databaseIDs, comment, waitingID=""):
super(SendInvitesCtx, self).__init__(waitingID=waitingID)
self.__databaseIDs = databaseIDs[:300]
if comment:
self.__comment = truncate_utf8(comment, INVITE_COMMENT_MAX_LENGTH)
else:
self.__comment = ""
示例3: setComment
def setComment(self, comment):
self.__comment = truncate_utf8(comment, PREBATTLE_COMMENT_MAX_LENGTH)
示例4: __init__
def __init__(self, prbType, waitingID = '', isOpened = True, comment = '', isRequestToCreate = True, flags = _FUNCTIONAL_FLAG.UNDEFINED):
super(_TeamSettingsCtx, self).__init__(entityType=prbType, waitingID=waitingID, flags=flags)
self.__isOpened = isOpened
self.__comment = truncate_utf8(comment, PREBATTLE_COMMENT_MAX_LENGTH)
self._isRequestToCreate = isRequestToCreate
示例5: __init__
def __init__(self, waitingID = '', isOpened = True, comment = '', isRequestToCreate = True, funcExit = prb_settings.FUNCTIONAL_EXIT.PREBATTLE):
super(TeamSettingsCtx, self).__init__(waitingID=waitingID, funcExit=funcExit)
self.__isOpened = isOpened
self.__comment = truncate_utf8(comment, PREBATTLE_COMMENT_MAX_LENGTH)
self.__isForced = False
self._isRequestToCreate = isRequestToCreate
示例6: __init__
def __init__(self, clubDbID, minWinRate = 0, minBattleCount = 0, description = '', waitingID = '', confirmID = ''):
super(SetApplicantsRequirements, self).__init__(clubDbID, waitingID=waitingID, confirmID=confirmID)
self.__minWinRate = minWinRate
self.__minBattleCount = minBattleCount
self.__description = truncate_utf8(description, CLUB_LIMITS.MAX_SHORT_DESC_LENGTH)
示例7: __init__
def __init__(self, comment, waitingID = ''):
super(ChangeCommentUnitCtx, self).__init__(waitingID=waitingID)
self.__comment = truncate_utf8(comment, prb_settings.UNIT_COMMENT_MAX_LENGTH)