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