Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
23e21e7c
Commit
23e21e7c
authored
Dec 29, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor editing corrections.
parent
983c930c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
31 deletions
+32
-31
Lib/string.py
Lib/string.py
+13
-13
Lib/stringold.py
Lib/stringold.py
+13
-13
Modules/stropmodule.c
Modules/stropmodule.c
+6
-5
No files found.
Lib/string.py
View file @
23e21e7c
...
...
@@ -45,7 +45,7 @@ atol_error = ValueError
def
lower
(
s
):
"""lower(s) -> string
Return a copy of the string s converted to lowercase
Return a copy of the string s converted to lowercase
.
"""
res
=
''
...
...
@@ -57,7 +57,7 @@ def lower(s):
def
upper
(
s
):
"""upper(s) -> string
Return a copy of the string s converted to uppercase
Return a copy of the string s converted to uppercase
.
"""
res
=
''
...
...
@@ -67,10 +67,10 @@ def upper(s):
# Swap lower case letters and UPPER CASE
def
swapcase
(
s
):
"""swapcase(s) -> strng
"""swapcase(s) -> str
i
ng
Return a copy of the string s with upper case characters
converted to lowercase and vice versa
converted to lowercase and vice versa
.
"""
res
=
''
...
...
@@ -83,7 +83,7 @@ def strip(s):
"""strip(s) -> string
Return a copy of the string s with leading and trailing
whitespace removed
whitespace removed
.
"""
i
,
j
=
0
,
len
(
s
)
...
...
@@ -95,7 +95,7 @@ def strip(s):
def
lstrip
(
s
):
"""lstrip(s) -> string
Return a copy of the string s with leading whitespace removed
Return a copy of the string s with leading whitespace removed
.
"""
i
,
j
=
0
,
len
(
s
)
...
...
@@ -106,7 +106,8 @@ def lstrip(s):
def
rstrip
(
s
):
"""rstrip(s) -> string
Return a copy of the string s with trailing whitespace removed
Return a copy of the string s with trailing whitespace
removed.
"""
i
,
j
=
0
,
len
(
s
)
...
...
@@ -174,7 +175,6 @@ def splitfields(s, sep=None, maxsplit=0):
res
.
append
(
s
[
i
:
j
])
i
=
j
=
j
+
nsep
if
count
>=
maxsplit
:
break
else
:
j
=
j
+
1
res
.
append
(
s
[
i
:])
...
...
@@ -185,8 +185,8 @@ def join(words, sep = ' '):
"""join(list [,sep]) -> string
Return a string composed of the words in list, with
intervening occurences of sep.
The default separator is a
s
ingle s
pace.
intervening occurences of sep.
Sep defaults to a single
space.
(joinfields and join are synonymous)
...
...
@@ -306,7 +306,7 @@ def rfind(s, sub, i = 0, last=None):
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return
s
-1 on failure.
Return -1 on failure.
"""
Slen
=
len
(
s
)
# cache this value, for speed
...
...
@@ -484,7 +484,7 @@ def expandtabs(s, tabsize=8):
Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current
column, and the tabsize (default
=
8).
column, and the tabsize (default
8).
"""
res
=
line
=
''
...
...
Lib/stringold.py
View file @
23e21e7c
...
...
@@ -45,7 +45,7 @@ atol_error = ValueError
def
lower
(
s
):
"""lower(s) -> string
Return a copy of the string s converted to lowercase
Return a copy of the string s converted to lowercase
.
"""
res
=
''
...
...
@@ -57,7 +57,7 @@ def lower(s):
def
upper
(
s
):
"""upper(s) -> string
Return a copy of the string s converted to uppercase
Return a copy of the string s converted to uppercase
.
"""
res
=
''
...
...
@@ -67,10 +67,10 @@ def upper(s):
# Swap lower case letters and UPPER CASE
def
swapcase
(
s
):
"""swapcase(s) -> strng
"""swapcase(s) -> str
i
ng
Return a copy of the string s with upper case characters
converted to lowercase and vice versa
converted to lowercase and vice versa
.
"""
res
=
''
...
...
@@ -83,7 +83,7 @@ def strip(s):
"""strip(s) -> string
Return a copy of the string s with leading and trailing
whitespace removed
whitespace removed
.
"""
i
,
j
=
0
,
len
(
s
)
...
...
@@ -95,7 +95,7 @@ def strip(s):
def
lstrip
(
s
):
"""lstrip(s) -> string
Return a copy of the string s with leading whitespace removed
Return a copy of the string s with leading whitespace removed
.
"""
i
,
j
=
0
,
len
(
s
)
...
...
@@ -106,7 +106,8 @@ def lstrip(s):
def
rstrip
(
s
):
"""rstrip(s) -> string
Return a copy of the string s with trailing whitespace removed
Return a copy of the string s with trailing whitespace
removed.
"""
i
,
j
=
0
,
len
(
s
)
...
...
@@ -174,7 +175,6 @@ def splitfields(s, sep=None, maxsplit=0):
res
.
append
(
s
[
i
:
j
])
i
=
j
=
j
+
nsep
if
count
>=
maxsplit
:
break
else
:
j
=
j
+
1
res
.
append
(
s
[
i
:])
...
...
@@ -185,8 +185,8 @@ def join(words, sep = ' '):
"""join(list [,sep]) -> string
Return a string composed of the words in list, with
intervening occurences of sep.
The default separator is a
s
ingle s
pace.
intervening occurences of sep.
Sep defaults to a single
space.
(joinfields and join are synonymous)
...
...
@@ -306,7 +306,7 @@ def rfind(s, sub, i = 0, last=None):
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return
s
-1 on failure.
Return -1 on failure.
"""
Slen
=
len
(
s
)
# cache this value, for speed
...
...
@@ -484,7 +484,7 @@ def expandtabs(s, tabsize=8):
Return a copy of the string s with all tab characters replaced
by the appropriate number of spaces, depending on the current
column, and the tabsize (default
=
8).
column, and the tabsize (default
8).
"""
res
=
line
=
''
...
...
Modules/stropmodule.c
View file @
23e21e7c
...
...
@@ -32,9 +32,10 @@ PERFORMANCE OF THIS SOFTWARE.
/* strop module */
static
char
strop_module__doc__
[]
=
"Common string manipulations, optimized for speed
\n
\
"Common string manipulations, optimized for speed.
\n
\
Always use
\"
import string
\"
rather than referencing
\n
\
this module directly"
;
this module directly
.
"
;
#include "Python.h"
...
...
@@ -192,10 +193,10 @@ static char joinfields__doc__[] =
joinfields(list [,sep]) -> string
\n
\
\n
\
Return a string composed of the words in list, with
\n
\
intervening occurences of sep.
The default separator is a
\n
\
s
ingle s
pace.
\n
\
intervening occurences of sep.
Sep defaults to a single
\n
\
space.
\n
\
\n
\
(join
fields and join
are synonymous)"
;
(join
and joinfields
are synonymous)"
;
static
PyObject
*
strop_joinfields
(
self
,
args
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment