473,378 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

StringBuffer Question

Hi All

I just want to know if someone can help me to empty
the values in a SringBuffer

Thanks
Johnny
Jul 17 '05 #1
4 10475
IS
Have you considered using delete(0, int end) ?

IS

"johnny luiz" <jo*****@nupay.co.za> wrote in message
news:8a********************@is.co.za...
Hi All

I just want to know if someone can help me to empty
the values in a SringBuffer

Thanks
Johnny

Jul 17 '05 #2


While it was 14/11/03 1:35 pm throughout the UK, johnny luiz sprinkled
little black dots on a white screen, and they fell thus:
Hi All

I just want to know if someone can help me to empty
the values in a SringBuffer


What values?

To empty a StringBuffer, use setLength(0) on it.

Or do you mean something else?

Stewart.

--
My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment. Please keep
replies on the 'group where everyone may benefit.
Jul 17 '05 #3
I would like to know
how to empty out a strring buffer.

i am developing an application that uses serial com communication
that receives infor from the port. i write the data into a stringbuffer.
when new info is received at the port i read it into the stringbuffer
but the previous data is still in the stringbuffer. ia don't what the
previous info
there.

I have tried both the above mentioned scenarios adn they didnt
help

"Stewart Gordon" <sm*******@yahoo.com> wrote in message
news:bp**********@sun-cc204.lut.ac.uk...


While it was 14/11/03 1:35 pm throughout the UK, johnny luiz sprinkled
little black dots on a white screen, and they fell thus:
Hi All

I just want to know if someone can help me to empty
the values in a SringBuffer


What values?

To empty a StringBuffer, use setLength(0) on it.

Or do you mean something else?

Stewart.

--
My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment. Please keep
replies on the 'group where everyone may benefit.

Jul 17 '05 #4

"johnny luiz" <jo*****@nupay.co.za> wrote in message
news:e4********************@is.co.za...
I would like to know
how to empty out a strring buffer.

i am developing an application that uses serial com
communication that receives infor from the port. i
write the data into a stringbuffer.

when new info is received at the port i read it into
the stringbuffer but the previous data is still in the
stringbuffer. ia don't what the previous info there.

I have tried both the above mentioned scenarios adn
they didnt help


StringBuffer sb("ABCDE");

// 1) Empty buffer using 'delete'
sb.delete(0, sb.length());

// or:

// 2) Empty buffer using 'replace'
sb.replace(0, sb.length(), "");

// or:

// 3) Empty buffer using 'setLength'
sb.setLength(0);

All three of these approaches have the effect of 'emptying' the StringBuffer
object of its contents [of characters] but do not alter its capacity, the
currently-available storage for additional characters.

Your problem is likely to have other causes. Perhaps if you posted the
relevant piece of source code constructive suggestions could be made.

I hope this helps.

Anthony Borla

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
2
by: harpreet1433 | last post by:
problem is i have java StringBuffer i want to print it with javascript on jsp page i tried it like var s= <%=StringBuffer object %>; document.write(s); but nt wrking
2
by: helpamit | last post by:
what is difference between string and stringbuffer? which is more efficient?
2
by: dksuresh1983 | last post by:
what is meant by Buffer in StringBuffer?
4
by: anthonette50 | last post by:
I am trying to understand what the code below is doing, i know the functions of a string buffer, however am finding it difficult to interprete the aim of the code below. Hope someone can help me? ...
5
by: VigneshMohan | last post by:
Hi All I wanted to replace the String Concatenation using " + " with a string buffer to eliminate performance hogs. I have a string String str = "Testing "+ firstStrVariable + "NextTest" +...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.