Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d4aa4f

Browse files
committed
Removed *.libs (now in ./sgi);
added gettext() method to TextEdit.py; fixed string.atoi() to ignore leading zeros.
1 parent de126a6 commit 2d4aa4f

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

Lib/lib-stdwin/TextEdit.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def createboxed(self, (parent, (cols, rows), (dh, dv))):
2727
def settext(self, text):
2828
self.editor.settext(text)
2929
#
30+
def gettext(self):
31+
return self.editor.gettext(text)
32+
#
3033
# Downcalls from parent to child
3134
#
3235
def destroy(self):

Lib/stdwin/TextEdit.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def createboxed(self, (parent, (cols, rows), (dh, dv))):
2727
def settext(self, text):
2828
self.editor.settext(text)
2929
#
30+
def gettext(self):
31+
return self.editor.gettext(text)
32+
#
3033
# Downcalls from parent to child
3134
#
3235
def destroy(self):

Lib/string.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,16 @@ def index(s, sub):
102102
# Convert string to integer
103103
atoi_error = 'non-numeric argument to string.atoi'
104104
def atoi(str):
105+
sign = ''
105106
s = str
106-
if s[:1] in '+-': s = s[1:]
107+
if s[:1] in '+-':
108+
sign = s[0]
109+
s = s[1:]
107110
if not s: raise atoi_error, str
111+
while s[0] == '0' and len(s) > 1: s = s[1:]
108112
for c in s:
109113
if c not in digits: raise atoi_error, str
110-
return eval(str)
114+
return eval(sign + s)
111115

112116
# Left-justify a string
113117
def ljust(s, width):

Lib/stringold.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,16 @@ def index(s, sub):
102102
# Convert string to integer
103103
atoi_error = 'non-numeric argument to string.atoi'
104104
def atoi(str):
105+
sign = ''
105106
s = str
106-
if s[:1] in '+-': s = s[1:]
107+
if s[:1] in '+-':
108+
sign = s[0]
109+
s = s[1:]
107110
if not s: raise atoi_error, str
111+
while s[0] == '0' and len(s) > 1: s = s[1:]
108112
for c in s:
109113
if c not in digits: raise atoi_error, str
110-
return eval(str)
114+
return eval(sign + s)
111115

112116
# Left-justify a string
113117
def ljust(s, width):

0 commit comments

Comments
 (0)