Fred Drake
13a2c279c5
Untabify to pass the -tt test.
2000-02-10 17:17:14 +00:00
Barry Warsaw
226ae6ca12
Mainlining the string_methods branch. See branch revision log
...
messages for specific changes.
1999-10-12 19:54:53 +00:00
Guido van Rossum
9a34523e19
As Tim Peters points out, ``from string import *'' should not set re to None.
...
Also rename safe_env to _safe_env.
1998-04-20 14:01:00 +00:00
Guido van Rossum
a6bb6be95f
Strip argument to atol and atof to match what strop does better.
1998-03-30 17:22:30 +00:00
Guido van Rossum
8ca842066c
A few lines were indented using spaces instead of tabs -- fix them.
1998-03-26 20:56:10 +00:00
Guido van Rossum
23e21e7cf3
Minor editing corrections.
1997-12-29 19:57:36 +00:00
Guido van Rossum
2003204ba7
Added doc string, provided by Charles Waldman (with some reformatting
...
and a little editing my me).
1997-12-29 19:26:28 +00:00
Guido van Rossum
d0753e20b2
At Barry's suggestion, plug the security leak by using an empty
...
__builtins__ for all calls to eval(). This still allows someone to
write string.atof("[1]*1000000") (which Jim Fulton worries about) but
effectively disables access to system modules and functions.
1997-12-10 22:59:55 +00:00
Guido van Rossum
90d62ab0a1
Since this module is used as a fallback in case no built-in modules
...
have been configured, string.atof() should not fail when "import re"
fails (usually because pcre is not there).
This opens up a tiny security hole: *if* an attacker can make "import
re" fail, they can also make string.atof(arbitrary_string) evaluate
the arbitrary string. Nothing to keep me awake at night...
1997-12-10 22:35:02 +00:00
Guido van Rossum
06ba34c5d4
In string.split(), honor maxsplit (if > 0).
...
In string.splitfields(), ignore maxsplit if <= 0, rather than ignoring
maxsplit=0 but effectively treating negative numbers the same as
maxsplit=1. Also made the test for maxsplit slightly more efficient
(set it to the length of the string when <= 0 so the test for its
presence can be omitted from the loop).
1997-12-01 15:25:19 +00:00
Guido van Rossum
9694fcab53
Convert all remaining *simple* cases of regex usage to re usage.
1997-10-22 21:00:49 +00:00
Guido van Rossum
1510565cb5
Add optional 4th argument to count(), matching find() etc.
...
Also change all occurrences of "x == None" to "x is None" (not that it
matters much, these functions are all reimplemented in strop -- but
count() is not).
1997-10-20 23:31:15 +00:00
Guido van Rossum
21aa0ef351
Changed my mind on replace().
...
It's now replace(str, old, new, maxsplit=0).
Note new ordering of parameters (string first);
this is more consistent with translate().
1997-04-02 05:49:46 +00:00
Guido van Rossum
1eb9a81eb9
Added new functions replace() and replace1().
1997-03-25 16:50:31 +00:00
Guido van Rossum
7b7c578616
Add optional 4th argument to [r]find and [r]index (end of slice).
1997-03-14 04:13:56 +00:00
Guido van Rossum
f480c674b1
Use correct separator for capwords(s, sep).
1996-08-26 15:55:00 +00:00
Guido van Rossum
34f173110f
Add optional separator character to capwords(), for completeness.
1996-08-20 20:25:41 +00:00
Guido van Rossum
306a8a6338
Add optional third parameter to split() and splitfields(), giving the
...
maximum number of delimiters to parse; e.g.
splitfields("a,b,c,d", ",", 2) -> ["a", "b", "c,d"].
1996-08-08 18:40:59 +00:00
Guido van Rossum
ed7253ca50
Added 3rd optional argument to translate(), a string of characters to delete.
...
Added maketrans(), a utility to create a translation table.
1996-07-23 18:12:39 +00:00
Guido van Rossum
8775d8b9dc
Added capitalize() and capwords().
1996-06-11 18:43:00 +00:00
Guido van Rossum
2539528810
add translate() -- which was in strop per release 1.3
1996-05-28 23:08:45 +00:00
Guido van Rossum
894a7bb995
default tabsize to 8
1995-08-10 19:42:05 +00:00
Guido van Rossum
2ab19920fc
make split and splitfields, join and joinfields synonyms
1995-06-22 18:58:00 +00:00
Guido van Rossum
8c1688e132
add dummy base to atoi/atol; careful about negative start indices in find/count
1995-03-14 17:43:02 +00:00
Guido van Rossum
710c352d05
* Lib/string.py: find/rfind is now the main implementation and
...
index/rindex is a wrapper that raises index_error (which is now
always ValueError)
1994-08-17 13:16:11 +00:00