Is there anything similar to StringBuffer in Smalltalk ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there anything similar to StringBuffer in Smalltalk ?

Narender Sharma

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/1OD_7UuN2zEJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Thanks!

Narender
Reply | Threaded
Open this post in threaded view
|

Re: Is there anything similar to StringBuffer in Smalltalk ?

Louis LaBrunda
Hi Narender,

I don't know a lot about Java and StringBuffer, so I may be misunderstanding your question but I think normal Strings should do it.

aString := 'first part', someStringVariable, 'last part'.

The "," comma will concatenate the strings.  Also take a look at the WriteStream class.  It is useful for building large strings with less overhead than string concatenation.

stream := WriteStream on: (String new: 1000).
stream nextPutAll: 'first part; nextPutAll: someStringVariable; nextPutAll: 'last part'; cr; cr; tab; nextPutAll: 'some more stuff'.
aString := stream contents.

Lou

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/nRbNv6puC10J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Aw: Re: Is there anything similar to StringBuffer in Smalltalk ?

Marten Feldtmann-2
StringBuffer have one feature: they are changeable. Instances of String are not changeable.


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/B1aHeMp5DBsJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Aw: Re: Is there anything similar to StringBuffer in Smalltalk ?

Louis LaBrunda
Changeable like this:

| s |
s := 'a string' copy.
s at: 1 put: $*.
s inspect.
s


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/YtQHBooWJ3wJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Aw: Re: Is there anything similar to StringBuffer in Smalltalk ?

Marten Feldtmann-2
Yes, I was not aware of that ... :-), but code like

| s |
s := 'a string'.
s at: 1 put: $*.
s inspect.
s

does not work, because it is a read-only object.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/Rw6kqTCYNXsJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Aw: Re: Is there anything similar to StringBuffer in Smalltalk ?

Normand Mongeau-2
You must know that already, but string litterals are read-only for very obvious reasons.


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/xiWZi-Ly92cJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Is there anything similar to StringBuffer in Smalltalk ?

Narender Sharma
In reply to this post by Louis LaBrunda
Thanks, it was something that I needed.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/B9YcxvCbmegJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Thanks!

Narender
Reply | Threaded
Open this post in threaded view
|

Re: Is there anything similar to StringBuffer in Smalltalk ?

Narender Sharma
In reply to this post by Louis LaBrunda
Thanks Louis, WriteStream was something that I needed.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/5jJyKJZ3QwkJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Thanks!

Narender
Reply | Threaded
Open this post in threaded view
|

Re: Is there anything similar to StringBuffer in Smalltalk ?

Louis LaBrunda
Hi,

You are very welcome!  Now that you are feeling a little grateful, maybe you will forgive a personal and probably ignorant question on my part.  Which is your first or given name and which is your surname, Narender or Sharma?  I don't mean any disrespect.  I like to keep things friendly and informal on the forum and like to address people by their given name but sometimes it is hard to tell which is which.  Please forgive my ignorance of your culture.

Lou

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/TGGiCX39HZQJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Is there anything similar to StringBuffer in Smalltalk ?

Narender Sharma
Hi Louis,
             I am fine with Narender as well as Sharma. However Narender would be more apt :). Its good to keep things friendly and hence there is nothing to forgive.

Thanks!

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/soNIDyRDV_8J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Thanks!

Narender