Ejemplo n.º 1
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])
Ejemplo n.º 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])
Ejemplo n.º 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]
Ejemplo n.º 4
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]
Ejemplo n.º 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
Ejemplo n.º 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])
Ejemplo n.º 7
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])
Ejemplo n.º 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)])
Ejemplo n.º 9
0
def is_space(string):
    for ch in string.string:
        if not unicodedb.isspace(ord(ch)):
            return space.false
    return space.true
Ejemplo n.º 10
0
def char_whitespace_huh(w_char):
    c = ord(w_char.value)
    return values.w_true if unicodedb.isspace(c) else values.w_false
Ejemplo n.º 11
0
 def is_space(self):
     if self.filled:
         return unicodedb.isspace(ord(self.current))
     return False
Ejemplo n.º 12
0
 def is_space(self):
     if self.filled:
         return unicodedb.isspace(ord(self.current))
     return False
Ejemplo n.º 13
0
 def skipspace(self):
     while unicodedb.isspace(ord(self.get())):
         self.index += 1
Ejemplo n.º 14
0
Archivo: string.py Proyecto: 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
Ejemplo n.º 15
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)])