summaryrefslogtreecommitdiffstats
path: root/Modules/stropmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Check for boundary errors in [r]find -- find("x", "", 2) should return -1.Guido van Rossum1998-03-241-2/+2
|
* Forgot to return NULL in joinfields() when a type error was detectedGuido van Rossum1998-02-061-1/+3
| | | | in one of the sequence items.
* Oops, big glitch. Charles had put a 1 in the column for argument listGuido van Rossum1997-12-301-8/+8
| | | | | | | | type for all functions. However many function call PyArg_Parse() and need a 0. This is so that when they didn't change anything, the can do Py_INCREF(args); return args. Reverted this back. For atof(), there's no reason not to use PyArg_ParseTuple(), so I changed the code (atoi and atol already used that).
* Oops, the last checkin left a blank line in a string literal.Guido van Rossum1997-12-301-1/+1
|
* Minor editing corrections.Guido van Rossum1997-12-291-5/+6
|
* Added doc string, provided by Charles Waldman (with some reformattingGuido van Rossum1997-12-291-29/+162
| | | | and a little editing my me).
* split_whitespace(): Make sure delimiter is stripped from the beginningBarry Warsaw1997-12-021-1/+4
| | | | | of the remainder item (last item in list) when maxsplit is < the number of occurrences.
* mymemreplace(), strop_replace(): Add support for optional 4th argumentBarry Warsaw1997-11-291-4/+12
| | | | | | | | maxsplit which is implemented in string.py but wasn't here. The reference manual doesn't define what happens when maxsplit is negative or larger than the number of occurrences, but in either case, I implemented this as all get replaced. Default value is zero which replaces all occurrences.
* Keep gcc -Wall happy.Guido van Rossum1997-04-291-1/+1
|
* Added replace() implementation by Perry Stoll (debugged and reformatted by me).Guido van Rossum1997-04-021-1/+167
|
* Add optional 4th argument to [r]find and [r]index (end of slice).Guido van Rossum1997-03-141-9/+27
|
* Changes for Lee Busby's SIGFPE patch set.Guido van Rossum1997-02-141-0/+2
| | | | | Two new modules fpectl and fpetest. Surround various and sundry f.p. operations with PyFPE_*_PROTECT macros.
* New strop_joinfields implementation, highly optimized for Lists. AllBarry Warsaw1997-01-061-60/+82
| | | | | | other sequences use the Sequence protocol from the abstract API. The algorithm has changed so that only one pass through the sequences are made.
* Rewrote translate() as follows:Guido van Rossum1997-01-061-28/+52
| | | | | | | | | | | | - 'delete' is a C++ keyword; use 'del_table' instead - apply Py_CHARMASK() to del_table[i] before using it as an index *** this fixes a bug that was just reported on the list *** - if the translation didn't make any changes, INCREF and return the original string - when del_table is empty or omitted, don't copy the translation table to a table of ints (should be a bit faster) Rewrote maketrans() to avoid copying the table (2-3% faster).
* strop_upper(), strop_lower(): shared code version caused to much of aBarry Warsaw1997-01-031-27/+65
| | | | | | | performance hit. Urg. Reverted. strop_joinfields(): re-instate optimizations for lists and tuples, but support arbitrary other kinds of sequences as well.
* Several changes:Barry Warsaw1997-01-031-142/+106
| | | | | | | | | | | | | | | | | | | | | | | - split_whitespace(): slightly better memory ref handling when errors occur. - strop_joinfields(): First argument can now be any sequence-protocol conformant object. - strop_find(), strop_rfind(): Use PyArg_ParseTuple for optional arguments - strop_lower(), strop_upper(): Factor logic into a common function do_casechange(). - strop_atoi(), strop_atol(): Use PyArg_ParseTuple. - strop_maketrans(): arguments used to be optional, although the documentation doesn't reflect this. Make the source conform to the docs. Arguments are required, but two empty strings will return the identity translation table. - General pass fixing up formatting, and checking for return values.
* Greatly renamed.Barry Warsaw1996-12-091-178/+181
|
* Keep gcc -Wall happy.Guido van Rossum1996-12-051-3/+3
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Replace all uses of strncmp (in split, find, rfind) with memcmp, soGuido van Rossum1996-10-041-3/+3
| | | | | embedded \0 in the delimiter is handled properly. Thanks to Sjoerd for suggesting this.
* Add text of argument to errors for atoi(), atol(), atof().Guido van Rossum1996-09-111-5/+25
|
* Raise ValueError on empty string passed into atoi(), atol(), atof().Guido van Rossum1996-08-211-0/+12
|
* Remove some unused variables.Guido van Rossum1996-08-191-9/+0
|
* Added lstrip() and rstrip().Guido van Rossum1996-08-081-17/+93
| | | | | | Extended split() (and hence splitfields(), which is the same function) to support an optional third parameter giving the maximum number of delimiters to parse.
* Added 3rd optional argument to translate(), a string of characters to delete.Guido van Rossum1996-07-231-11/+60
| | | | Added maketrans(), a utility to create a translation table.
* Test for zero-length argument in capitalize().Guido van Rossum1996-06-171-1/+1
|
* added capitalize()Guido van Rossum1996-06-121-0/+45
|
* added strop.translate(s, table)Guido van Rossum1995-09-131-0/+30
|
* unified join(fields), split(fields)Guido van Rossum1995-05-031-12/+20
|
* fix stupid bug in strip and splitGuido van Rossum1995-02-141-2/+2
|
* use Py_CHARMASKGuido van Rossum1995-02-101-14/+10
|
* Added 1995 to copyright message.Guido van Rossum1995-01-041-2/+2
| | | | | Setup.in: clarified Tk comments somewhat. structmodule.c: use memcpy() instead of double precision assignment.
* * various modules: #include "Python.h" and remove most remporaryGuido van Rossum1994-09-141-8/+4
| | | | renaming hacks
* * Modules/stropmodule.c: implement find/rfind instead ofGuido van Rossum1994-08-171-8/+6
| | | | | index/rindex (raising and catching an exception is much more expensive than returning and testing -1)
* * Modules/{Setup.in,Makefile.pre.in}: renamed some modules toGuido van Rossum1994-08-051-1/+1
| | | | | | | | | | shorter names (dropped the "module" from the name): sunaudiodev, imgformat, audioop, imageop, imgfile * Modules/stropmodule.c (strop_rindex): make rindex('abc', '') do the right thing (i.e. return 3 instead of 0) * Modules/socketmodule.c: disabled allowbroadcast() socket method
* Merge alpha100 branch back to main trunkGuido van Rossum1994-08-011-7/+108
|
* Fix memory leaks in join & joinfieldsGuido van Rossum1993-11-051-11/+25
|
* Added rindex(). index() and rindex() interpret negative start indexGuido van Rossum1993-10-261-5/+41
| | | | as normal indexing does.
* Several optimizations and speed improvements.Sjoerd Mullender1993-10-221-18/+25
| | | | cstubs: Use Matrix type instead of float[4][4].
* Bug fix: check whether call succeeded *after* the call.Sjoerd Mullender1993-09-141-1/+1
|
* * config.c: different default PYTHONPATH for MS-DOSGuido van Rossum1993-07-091-4/+34
| | | | | | | * timemodule.c: change #ifdef TURBO_C into #ifdef MSDOS * posixmodule.c: MSDOS changes by Marcel van der Peijl (Digicash) * stropmodule.c: use C isspace(c) to test for whitespace; add whitespace, lowercase and uppercase variables to the module.
* stropmodule.c: use C isspace(c) to test for whitespace; addGuido van Rossum1993-07-081-7/+19
| | | | whitespace variable to module dict.
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-291-2/+2
| | | | | | | | | | | | | | | | | * Stubs for faster implementation of local variables (not yet finished) * Added function name to code object. Print it for code and function objects. THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version number has changed accordingly) * Print address of self for built-in methods * New internal functions getattro and setattro (getattr/setattr with string object arg) * Replaced "dictobject" with more powerful "mappingobject" * New per-type functio tp_hash to implement arbitrary object hashing, and hashobject() to interface to it * Added built-in functions hash(v) and hasattr(v, 'name') * classobject: made some functions static that accidentally weren't; added __hash__ special instance method to implement hash() * Added proper comparison for built-in methods and functions
* * config.c: Added audioop to lists.Guido van Rossum1992-11-261-0/+65
| | | | | | | | | * Makefile: change default source directory * socketmodule.c: added getsockname and getpeername * bltinmodule.c: corrected typo in type() error message * Added new built-in functions str() and repr(): repr(x) == `x`; str(x) == x if x is a string, otherwise str(x) == repr(x). * Added joinfields to stropmodule.c (string.join calls joinfields now)
* Makefile uses $> more often; cgen supports filename argument; addedGuido van Rossum1992-09-111-0/+108
| | | | lower, upper and swapcase to strop; cosmetics.
* Re-implement some operations from string.py in C, for speed.Guido van Rossum1992-09-031-0/+201