Questions tagged [stringbuilder]

Stringbuilder is a class that provides a convenient and efficient way of working with text data in Java and .NET framework.

Stringbuilder is a class that provides a convenient and efficient way of working with text data. Implementation of the stringbuilder can be found in .NET framework and Java.

The very idea of the class is being a character array with the capability to insert and append new characters. It avoids copying the strings in the memory, hence improves the performance.

2114 questions
0
votes
2 answers

Merge / optimize substring statements

How can I optimize this code snippet? string page = wc.DownloadString("https://www.youtube.com/browse_ajax?action_continuation=1&continuation=4qmFsgI8EhhVQ2ZXdHFQeUJNR183aTMzT2VlTnNaWncaIEVnWjJhV1JsYjNNZ0FEQUJPQUZnQVdvQWVnRTB1QUVB"); int pos; while…
user8098743
0
votes
1 answer

Print HTML table in console using Java

I have a StringBuilder which contains a HTML table. I want to know, if I can print this table in the console using some kind of library or anything. For example: StringBuilder string = " …
Jhutan Debnath
  • 505
  • 3
  • 13
  • 24
0
votes
2 answers

How to find string inside particular string and insert

I have a method that gets XML string and in theory should insert a comment before EVERY particular tag. I wonder how to make it work public static String addCommentXML(String xmlString, String tagName, String comment) { StringBuilder sb = new…
Lone Star
  • 3
  • 1
0
votes
1 answer

How do you print out multiple words from a file?

I am having trouble printing out a list of words from a file. ******No error, just nothing prints out****** Here is the female_names.txt…
0
votes
4 answers

Java- unable to use StringBuilder correctly with Arrays

So i am trying to make this board of 10 rows and 10 columns. I have to used the StringBuilder method to make it but I am unable to do so. My output is coming out wrong. Here is my code import java.util.ArrayList; import java.util.Scanner; public…
0
votes
3 answers

StringBuilder.AppendLine not working when convert to string

For example a newPassword value of "Abcdefg". This will pass the first 2 criteria but fail the second 2 in the below code. This is what is being outputted: Password should contain at least one numeric value (0 through 9). Password should contain…
MadDev
  • 1,130
  • 1
  • 13
  • 29
0
votes
2 answers

Show a null in my Toast

I am newbie in Android developing, I run my very simple app but my Toast shows a null. I check my connection and 192.168.1.37/get_cat.php is correct in my browser. I think all on the server is correct and worked properly. Following my code: public…
0
votes
1 answer

StringBuffer.replace javadoc

I am confused by the official Javadoc which says public StringBuffer replace(int start, int end, String str) Replaces the characters in a substring of this sequence with characters in the specified String. The substring begins at the specified…
Toto
  • 397
  • 6
  • 17
0
votes
0 answers

Java Wallet Lab, converting array of int's to string using StringBuilder

I'm having a difficult time figuring out a way to convert a array of ints to a String just using String builder. In my toString Method, Am I using the right for loop? public class Wallet { // max possible # of banknotes in a wallet private…
kami
  • 21
  • 3
0
votes
1 answer

Put list of log4j loggers into StringBuilder and format

I am trying to add all log4j loggers into a list which needs to be put into StringBuilder. My method looks as follows: private void addLoggerInfo(StringBuilder sb) { LoggerContext ctx = (LoggerContext) LogManager.getContext(false); …
PineCone
  • 2,193
  • 12
  • 37
  • 78
0
votes
2 answers

Is Android Logcat limited to 4096 characters per output call?

I'm creating a StringBuilder with it's initial capacity to be 8192 and appending lines to fill it with a little under 6000 characters in this case. When I write the StringBuilder.toString() value out to the log it cuts off the last 1/4 or so of the…
Peter Flower
  • 363
  • 2
  • 20
0
votes
1 answer

Using string builder and array to in a loop java

Im trying to use a string builder to append both the first file with its location then new line second file with its location etc. How do I do this? Whats the correct syntax? Whats wrong with my below loop? @Override public List
RA19
  • 709
  • 7
  • 28
0
votes
1 answer

Buttons were created using stringbuilder in code behind. How can I make them call functions?

I've written a table in a stringbuilder that adds rows to the table depending on how many records are in a database. Each row is supposed to have three buttons that call different functions in code behind. Here's an example of what I mean: using…
TroutIn2D
  • 1
  • 6
0
votes
1 answer

Parsing array into CSV with headers using StringBuilder() -- issue with header row

I have a vector of labeled data elements, like this: [label1: 1.1, label2: 2.43, label3: 0.5] [label1: 0.1, label2: 2.0, label3: 1.0] There can be any number of elements, where each element essentially corresponds to a row of data. I'm trying to…
Hack-R
  • 22,422
  • 14
  • 75
  • 131
0
votes
2 answers

IndexOutOfBoundException on StringBuilder

I'm trying to replace pi with *pi using the following code, however it throws totally unexpected exception. How is the matcher looking at an index higher then String length? private void makeEvaluationStringExpressionMXParserCompliant() { …
user2498079
  • 2,872
  • 8
  • 32
  • 60
Company Contact