Issue529629

classification
Title: string.replace( java.lang.String )
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: bckfnn Nosy List: bckfnn, otmarhumbel
Priority: normal Keywords: patch

Created on 2002-03-13.21:36:40 by otmarhumbel, last changed 2002-10-29.14:30:45 by bckfnn.

Messages
msg2228 (view) Author: Oti Humbel (otmarhumbel) Date: 2002-03-13.21:36:40
The recent discussion 
http://www.geocrawler.com/lists/3/SourceForge/7017/0/80
83538/
made me believe that maybe string.replace() could be a 
little more tolerant.

Add the following lines to string.py:

  import sys
  sys.add_package( "java.lang" )
  from java.lang import String

and change the replace method as follows:

  # Substring replacement (global)
  def replace(s, old, new, maxsplit=-1):
      """<unchanged>"""
      if isinstance( s, String ):
          return s.intern().replace(old, new, maxsplit)
      else:
          return s.replace(old, new, maxsplit)

Best wishes,
Oti.
msg2229 (view) Author: Finn Bock (bckfnn) Date: 2002-10-29.14:30:45
Logged In: YES 
user_id=4201

Rejected, both because string.py will become deprecated and
because this shouldn't be needed at all.
History
Date User Action Args
2002-03-13 21:36:40otmarhumbelcreate