473,465 Members | 3,216 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

string builder

36 New Member
StringBuilder builder1 = new StringBuilder();
StringBuilder builder2 = new StringBuilder(0);
StringBuilder builder3 = new StringBuilder(100);

System.out.println(builder1.capacity());
System.out.println(builder2.capacity());
System.out.println(builder3.capacity());

16
0
100
can any of tell me that why it give 16 output when first stringbuilder is call because it is empty string builder..........and what capacity do
May 1 '10 #1
1 2239
pbrockway2
151 Recognized Expert New Member
Both questions (the capacity of a SB made with the no-arg constructor, and the purpose of "capacity") are covered in the StringBuilder API docs.
May 2 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Karuppasamy | last post by:
Hi I am using a variable of StringBuilder to form a string. After appending a string of value like this {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Verdana;}}
12
by: Tee | last post by:
String Builder & String, what's the difference. and when to use which ? Thanks.
2
by: P K | last post by:
Hi, I have around 30 fields on a screen each one of which I need to validate. The idea was to have a set of messages to be displayed for all the posiible errors instead of having to show a...
4
by: Ahmed Hashish | last post by:
Dear Sir I have a UserControl with a property called 'ConnectionString', How I could trigger the connection string builder to allow users to generate that string in the property sheet. Thanks...
11
by: TheRain | last post by:
Hi, I am trying to append a carriage return to my string using the string builder class, but when I do this the string ends up containing "13". I tried this multiple ways like so ...
3
by: rsine | last post by:
I have searched around a little and have yet to find a naming convention for the string builder object. I really do not want to use "str" since this is for string objects and thus could be...
8
by: simonZ | last post by:
I have Function with string parameteres: public string newLine(String string1,String string2,String string3){ StringBuilder webLine = new StringBuilder(); webLine.Append("<tD nowrap>" +...
3
by: simonZ | last post by:
I read some articles about stringBuilder vs string. I'm using the loop, so I must use string builder. My example: String s1; String s2; String s3; StringBuilder webLines=new...
2
by: rocksoft | last post by:
Hi, I have used stream reader to read text file using Readline method, and i tried to append all string to string builder, but i'm not able to get all string value, i'm only getting last line of...
6
by: mcfly1204 | last post by:
I have a method where I am building an html email. Part of the way through the method, I have an if-statement that direct to another method based off of a field. For example: ...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.