示例#1
0
文件: string.py 项目: zen3d/pixie
def trim(a):
    a = rt.name(a)
    i = 0
    while i < len(a) and unicodedb.isspace(ord(a[i])):
        i += 1
    j = len(a)
    while j > 0 and unicodedb.isspace(ord(a[j - 1])):
        j -= 1
    if j <= i:
        return rt.wrap(u"")
    return rt.wrap(a[i:j])
示例#2
0
def trim(a):
    a = rt.name(a)
    i = 0
    while i < len(a) and unicodedb.isspace(ord(a[i])):
        i += 1
    j = len(a)
    while j > 0 and unicodedb.isspace(ord(a[j - 1])):
        j -= 1
    if j <= i:
        return rt.wrap(u"")
    return rt.wrap(a[i:j])
示例#3
0
    def trim(self):
        if len(self._s) == 0:
            return u""

        left = 0
        right = len(self._s)

        while left < right and unicodedb.isspace(ord(self._s[left])):
            left += 1

        while left < right and unicodedb.isspace(ord(self._s[right - 1])):
            right -= 1

        assert right >= 0, "StrObject.trim/0: Proven impossible"
        return self._s[left:right]
示例#4
0
文件: data.py 项目: washort/typhon
    def trim(self):
        if len(self._s) == 0:
            return u""

        left = 0
        right = len(self._s)

        while left < right and unicodedb.isspace(ord(self._s[left])):
            left += 1

        while left < right and unicodedb.isspace(ord(self._s[right - 1])):
            right -= 1

        assert right >= 0, "StrObject.trim/0: Proven impossible"
        return self._s[left:right]
示例#5
0
def is_space(string):
    for ch in string.string:
        if not unicodedb.isspace(ord(ch)):
            return space.false
    if len(string.string) == 0:
        return space.false
    return space.true
示例#6
0
def trimr(a):
    a = rt.name(a)
    j = len(a)
    while j > 0 and unicodedb.isspace(ord(a[j - 1])):
        j -= 1
    if j <= 0:
        return rt.wrap(u"")
    return rt.wrap(a[0:j])
示例#7
0
文件: string.py 项目: zen3d/pixie
def trimr(a):
    a = rt.name(a)
    j = len(a)
    while j > 0 and unicodedb.isspace(ord(a[j - 1])):
        j -= 1
    if j <= 0:
        return rt.wrap(u"")
    return rt.wrap(a[0:j])
示例#8
0
def triml(a):
    a = rt.name(a)
    i = 0
    while i < len(a) and unicodedb.isspace(ord(a[i])):
        i += 1
    return rt.wrap(a[i:len(a)])
示例#9
0
文件: string.py 项目: cheery/lever
def is_space(string):
    for ch in string.string:
        if not unicodedb.isspace(ord(ch)):
            return space.false
    return space.true
示例#10
0
文件: string.py 项目: vishesh/pycket
def char_whitespace_huh(w_char):
    c = ord(w_char.value)
    return values.w_true if unicodedb.isspace(c) else values.w_false
示例#11
0
 def is_space(self):
     if self.filled:
         return unicodedb.isspace(ord(self.current))
     return False
示例#12
0
 def is_space(self):
     if self.filled:
         return unicodedb.isspace(ord(self.current))
     return False
示例#13
0
文件: json.py 项目: whitten/lever
 def skipspace(self):
     while unicodedb.isspace(ord(self.get())):
         self.index += 1
示例#14
0
文件: string.py 项目: 8l/pycket
def char_whitespace_huh(w_char):
    c = ord(w_char.value)
    return values.w_true if unicodedb.isspace(c) else values.w_false
示例#15
0
文件: string.py 项目: zen3d/pixie
def triml(a):
    a = rt.name(a)
    i = 0
    while i < len(a) and unicodedb.isspace(ord(a[i])):
        i += 1
    return rt.wrap(a[i:len(a)])