stringbuilder Questions

2

Solved

I was designated to make refactoring on a project, and I came across this situation this.path = DESTINY + deploy.name() + FILE_SEPARATOR + delivery.getSystem().getCode() + FILE_SEPARATOR + deliv...
Nicole asked 31/1, 2018 at 13:16

2

Solved

I would really appreciate someone help me resolving the following issue: I am getting now and then the following exception: Index was out of range. Must be non-negative and less than the size o...
Yakutsk asked 28/9, 2012 at 18:23

4

Solved

Why is StringBuilder much faster than string concatenation using the + operator? Even though that the + operator internally is implemented using either StringBuffer or StringBuilder. public void sh...
Suu asked 16/3, 2014 at 16:0

19

Solved

When you have to loop through a collection and make a string of each data separated by a delimiter, you always end up with an extra delimiter at the end, e.g. for (String serverId : serverIds) { ...
Duane asked 3/8, 2010 at 9:41

3

Solved

I am writing files to disk using Scala. To create the whole String that will be written to the file, I am currently iterating over my data and appending all the information to a StringBuilder obje...
Saxen asked 31/7, 2015 at 16:54

10

Solved

I was wondering about StringBuilder and I've got a question that I was hoping the community would be able to explain. Let's just forget about code readability, which of these is faster and why? S...
Salmanazar asked 2/4, 2009 at 16:29

3

Solved

As I know if i declared a dictionary, i could call myDict.Clear() for reusing purpose. Now if I declared a sb as a StingBuilder obj. StringBuilder sb = new StringBuilder(); How to reuse sb? tha...
Kopje asked 4/1, 2010 at 7:51

7

Solved

What is an efficient way to trim whitespace from the end of a StringBuilder without calling ToString().Trim() and back to a new SB new StringBuilder(sb.ToString().Trim()).
Deathbed asked 15/7, 2014 at 23:17

7

Solved

I have a StringBuilder that accumulates code. In some cases, it has 2 empty lines between code blocks, and I'd like to make that 1 empty line. How can I check if the current code already has an emp...
Loutitia asked 27/12, 2012 at 12:7

13

Solved

I have the following data.AppendFormat("{0},",dataToAppend); The problem with this is that I am using it in a loop and there will be a trailing comma. What is the best way to remove the ...
Discus asked 20/6, 2013 at 13:34

3

Solved

I want to test if the StringBuilder is empty but there is no IsEmpty method or property. How does one determine this?
Pass asked 1/8, 2017 at 8:52

10

Solved

I have a list of Strings, and I want to concatenate them with spaces in between. So I'm using StringBuilder. Now if any of the Strings are null, they get stored in the StringBuilder literally as 'n...
Ida asked 18/10, 2010 at 15:33

5

Solved

I have a created a StringBuilder of length "132370292", when I try to get the string using the ToString() method it throws OutOfMemoryException. StringBuilder SB = new StringBuilder(); for(int i ...
Suppository asked 29/7, 2014 at 7:56

10

Solved

This should hopefully be a quick one. I have a StringBuilder like so: StringBuilder sb = new StringBuilder(); I append to my StringBuilder like so: sb.Append("Foo"); sb.Append("Bar"); I then ...
Cupellation asked 15/2, 2012 at 10:27

12

Solved

What is some real time situation to compare String, StringBuffer, and StringBuilder?
Phosphor asked 4/6, 2010 at 3:28

5

Solved

Hello I have following method to display a promotion line when I comment a shoutbox: public String getShoutboxUnderline(){ StringBuilder builder = new StringBuilder(); builder.append("watch"); ...
Merideth asked 26/1, 2016 at 12:29

15

I've a performance related question regarding use of StringBuilder. In a very long loop I'm manipulating a StringBuilder and passing it to another method like this: for (loop condition) { StringB...
Croat asked 28/10, 2008 at 7:9

20

Solved

Given the 2 toString() implementations below, which one is preferred: public String toString(){ return "{a:"+ a + ", b:" + b + ", c: " + c +"}"; } or public String toString(){ StringBuilder s...
Presentational asked 7/10, 2009 at 15:44

33

Solved

What is the main difference between StringBuffer and StringBuilder? Is there any performance issues when deciding on any one of these?
Rowney asked 10/12, 2008 at 4:34

7

Solved

I want to break a string up into lines of a specified maximum length, without splitting any words, if possible (if there is a word that exceeds the maximum line length, then it will have to be spli...
Slimsy asked 13/3, 2014 at 3:23

6

Solved

This is a simple one, and one that I thought would have been answered. I did try to find an answer on here, but didn't come up with anything - so apologies if there is something I have missed. Any...
Decoteau asked 25/10, 2010 at 14:36

8

Im trying to create a palindrome checker. I am using a StringBuilder and I've discovered that appending spaces are kind of tricky. EDIT: are there other ways besides using .reverse()? Thanks for t...
Tensive asked 6/3, 2013 at 14:20

11

Solved

I see a few The Code Project solutions. But is there a regular implementation in JavaScript?
Balthasar asked 18/1, 2010 at 16:29

2

While appending strings to a StringBuilder, can its Capacity and Length go beyond its MaxCapacity? According to MSDN MaxCapacity is defined as "The maximum number of characters string builder inst...
Criminate asked 7/9, 2015 at 6:38

6

Solved

I've been wondering about the implementation of charAt function for String/StringBuilder/StringBuffer in java what is the complexity of that ? also what about the deleteCharAt() in StringBuffer/Str...
Solidary asked 23/6, 2011 at 22:32

© 2022 - 2024 — McMap. All rights reserved.