OK, now I think I understand what the length applies to - the substr of
the target that is being replaced, not the length of the replacing
substr. (That doesn't read too well does it?) But the 3 chars of
'abcdef' starting at 3 is 'abcdef'~substr(3,3) or 'cde', right? So, if
we replace that with ' ' then the result is 'ab f', no?
Rick McGuire wrote:
> replaceAt() does a replacement of one substring with another string. Thus
>
> "abcdef"~replaceAt(" ",3, 3) -> "ab ef"
>
> is correct. It replaces the 3 characters beginning at postion 3 with
> the string " ". The resulting string is shorter than the original
> string.
>
> In the second example, the replacement position is beyond the original
> string. This version is essentially the same as using overlay,
> because there are no characters snipped out from the original.
>
> Rick
>
>
> On Sat, May 9, 2009 at 10:24 AM, Gil Barmwater <[email protected]>
> wrote:
>
>>OK, thanks. Still not clear about these examples for replaceAt:
>>
>>"abcdef"~replaceAt(" ",3, 3) -> "ab ef"
>>"abc"~replaceAt("123",5,6,"+") -> "abc+123"
>>
>>I would think that the first would give "ab f", i.e. 'cde' replaced
>>with 3 blanks. And the second I don't get at all :-(
>>
>>Rick McGuire wrote:
>>
>>>On Sat, May 9, 2009 at 7:36 AM, Gil Barmwater <[email protected]>
>>>wrote:
>>>
>>>
>>>>Having almost completed my presntation on the new stuff in 4.0.0, I just
>>>>have four more questions.
>>>>
>>>>1) The ReadMe says "The MutableBuffer class has been enhanced so that it
>>>>has most, if not all, of the methods of the String class." Do we know
>>>>of any methods that are NOT in both or should it say "...has all..."?
>>>
>>>
>>>There are quite a few that were not implemented becaus they really did
>>>not make much sense for a mutablebuffer. For example, the arithmetic
>>>functions (min, max, sign, abs), the various conversion functions
>>>(d2c(), etc.), datatype(). There might be others, but those are the
>>>ones the spring immediately to mind. I believe the set of "string"
>>>functions is fairly complete, but even here there are exceptions
>>>(abbrev(), the base64 encode/decode).
>>>
>>>
>>>
>>>>2) Can you explain when one would use the String Class replaceAt()
>>>>method rather than overlay() or changeStr()?
>>>
>>>
>>>Ok, here's a souce string" "aaaaaaaaaaaaaaaaaaaaaaaaa"
>>>
>>>Use chagestr to replace the characters starting at position 6 for 5
>>>characters with "123"
>>>
>>>Now try this with overlay()
>>>
>>>Now do you see the benefit of replaceAt() :-)
>>>
>>>To do this operation without replaceAt requests two substrings (or a
>>>parse operation, which is the equivalent) + two concatenate
>>>operations. This requires the creation of 4 objects to get one
>>>result. This can also be done with a delstr()/insert() combo, which
>>>only creates one extra object, but replaceAt() does it in one shot.
>>>replaceAt() is particularly useful with mutableBuffer if you're using
>>>it to make editing-type operations.
>>>
>>>
>>>
>>>
>>>>3) While I believe I understand the difference between a Table and an
>>>>IdentityTable, can you give me an example of when I would need to use an
>>>>IdentityTable rather than a Table?
>>>
>>>
>>>IdentityTable is used mostly for situations you need to keep track of
>>>actual object instances rather than relying on "equality", which may
>>>not be the same. The interpreter uses this internally, for example,
>>>to keep track of the objects that have a pending uninit() operation.
>>>In this situation, it is important that the table be able to use the
>>>object as an index even if the "==" method of the object claims that
>>>this object is "equal" to another object.
>>>
>>>At lot of the uses of this are pretty esoteric....but when you need
>>>it, you need it!
>>>
>>>
>>>
>>>>4) How are the new utility classes for sockets, MIME and SMTP provided,
>>>>i.e. where are they in the distribution, and what does one need to do to
>>>>make use of them?
>>>
>>>
>>>David will need to ansewr that one.
>>>
>>>
>>>
>>>>Once I make the updates based on the answers, I could send an outline
>>>>form of my presetation to anyone interested for review if you'd have
>>>>time. Want to make sure I got it right!
>>>
>>>
>>>Yes, please send me a copy.
>>>
>>>
>>>
>>>>--
>>>>Gil Barmwater
>>>>
>>>>------------------------------------------------------------------------------
>>>>The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>>>>production scanning environment may not be a perfect world - but thanks to
>>>>Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
>>>>i700
>>>>Series Scanner you'll get full speed at 300 dpi even with all image
>>>>processing features enabled. http://p.sf.net/sfu/kodak-com
>>>>_______________________________________________
>>>>Oorexx-devel mailing list
>>>>[email protected]
>>>>https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>>>
>>>
>>>
>>>------------------------------------------------------------------------------
>>>The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>>>production scanning environment may not be a perfect world - but thanks to
>>>Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
>>>Series Scanner you'll get full speed at 300 dpi even with all image
>>>processing features enabled. http://p.sf.net/sfu/kodak-com
>>>_______________________________________________
>>>Oorexx-devel mailing list
>>>[email protected]
>>>https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>>
>>
>>--
>>Gil Barmwater
>>
>>------------------------------------------------------------------------------
>>The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>>production scanning environment may not be a perfect world - but thanks to
>>Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
>>Series Scanner you'll get full speed at 300 dpi even with all image
>>processing features enabled. http://p.sf.net/sfu/kodak-com
>>_______________________________________________
>>Oorexx-devel mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> Oorexx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
--
Gil Barmwater
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel