stringbuilder Questions

3

I am trying to convert String builder to String array in java.I have used to String method to convert the Stringbuilder to String and then use split method to convert it to String array. I am faci...
Ritual asked 26/12, 2016 at 6:10

6

What is the difference between StringWriter and StringBuilder and when should I use one or the other?
Highpitched asked 2/3, 2009 at 13:4

6

Solved

I want to check for null or empty specifically in my code. Does empty and null are same for StringBuilder in Java? For example: StringBuilder state = new StringBuilder(); StringBuilder err= new S...
Sandry asked 4/2, 2014 at 13:14

1

All.I have a java code snippet like this: String a = new StringBuilder("app").append("le").toString(); System.out.println(a.intern() == a); String b = new StringBuilder("orange").toString(); S...
Madonnamadora asked 8/10, 2016 at 7:7

2

Solved

The class StringBuilder defines four constructors, and none of them accepts a StringBuilder, yet the following compiles: StringBuilder sb = new StringBuilder(new StringBuilder("Hello")); Does th...
Jauregui asked 14/8, 2016 at 15:53

10

Solved

It was an interview question. I was asked to implement the StringBuffer append function. I saw the code after the interview. But I cannot understand how the operation is done with creation of a sin...
Libove asked 4/11, 2011 at 15:5

7

Solved

Why there is no reverse method in String class in Java? Instead, the reverse() method is provided in StringBuilder? Is there a reason for this? But String has split(), regionMatches(), etc., which ...
Soloma asked 14/9, 2011 at 17:27

1

Solved

I am writing a spell corrector that gives suggestions to the user. To do this, I am using words one and two edit distance away. There are four techniques: deleting one letter of the word, transpo...
Emit asked 5/5, 2016 at 14:1

1

Solved

The following returns nothing for me in eclipse, is this expected behaviour ? StringBuilder sb = new StringBuilder(""); for(int i = 0; i < 256*256*2*6; i++) { sb.append("a"); } System.out.prin...
Attention asked 3/5, 2016 at 8:51

2

Solved

I have the code like this: String str1 = new StringBuilder("计算机").append("软件").toString(); System.out.println(str1.intern() == str1); //true String str2 = new StringBuilder("ja").append("va...
Yahairayahata asked 17/3, 2016 at 14:25

1

Solved

I've run into an issue with stringbuilder which I can't seem to solve. To simplify the problem I create the following method: private static string TestBigStrings() { StringBuilder builder = new ...
Rauwolfia asked 5/3, 2016 at 10:17

6

Solved

I have 5 checkboxes and I have to select multiple checkboxes. I made a code like this to check check box is checked: sports=(CheckBox)findViewById(R.id.sports_btn); sports.setOnClickListener(new ...
Guglielma asked 17/11, 2011 at 12:29

2

Solved

The complete syntax of StringBuilder's Append(string s) function (and similar functions) is StringBuilder myStringBuilder.Append(string myString) since myStringBuilder.Append(string myString) al...
Ladon asked 15/2, 2016 at 10:2

8

Solved

How can we re assign the value of a StringBuffer or StringBuilder Variable? StringBuffer sb=new StringBuffer("teststr"); Now i have to change the value of sb to "testString" without emptying the...
Corticosteroid asked 7/4, 2010 at 11:10

2

Solved

For some reason my for loop is not terminating in my CapitalizeFirstSentence method. I set a breakpoint at that line and the condition (i != -1) is unmet, so the loop should terminate, but it doesn...
Haem asked 21/1, 2016 at 8:21

2

Solved

As a follow-up to this question that I posted earlier, I am wondering about the cause of the issue I had. The problem was that I was getting this error when updating a JLabel with a lot of HTML te...
Angelinaangeline asked 4/1, 2016 at 14:33

3

Solved

Is there any difference in the performance of insert() vs append() from StringBuilder class? I will be building plenty of short string as text identifiers and asked myself this question... Should I...
Caption asked 27/11, 2015 at 11:15

6

I have different types of names. Like ABC BCD, EFG HGF, HGF HJK I want to replace the last , with "and". So, the format will be like this ABC BCD, EFG HGF & HGF HJK I tried with this na...
Naval asked 7/8, 2013 at 7:1

3

Should StringBuilder.Capacity be set to the maximum number of .NET characters, without regards to null termination, or must it be set one higher to reserve space for a null terminator when using P/...
Sputter asked 30/10, 2010 at 2:33

2

Solved

My program takes a input of a text file that has words each separated by a newline and my program takes it and deals with the data, and then I am required to output to a new file whilst keepi...
Nganngc asked 3/11, 2015 at 17:46

1

I have seen many similar questions on stackoverflow and tried a lot but still no success. So posting my problem. Here is my program: Get the http output of a response which is in xml. Store the ...
Interatomic asked 13/10, 2015 at 8:47

7

Solved

I would like several textboxes to react to changes of an underlying string. So if I were to change the content of the string, all those textboxes would change their content too. Now, I can't use t...
Fluviomarine asked 5/1, 2009 at 16:30

6

Solved

After doing some profiling, we've discovered that the current way in which our app concatenates strings causes an enormous amount of memory churn and CPU time. We're building a List<string> o...
Prefab asked 26/8, 2015 at 2:51

7

Solved

I am using StringBuilder to show comma between records, but also getting comma at the end of Last Record How to control on this ? I don't like to see comma at the end of last record - becaus...
Rodriquez asked 20/8, 2015 at 11:33

2

I need to add some lines to a StringBuilder, where the line added last should be at the beginning of the string and the oldest at the end. I add a new line like this: stringBuilder.Insert(0, "Some...
Mosier asked 11/4, 2015 at 5:31

© 2022 - 2024 — McMap. All rights reserved.