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
1 answer

Stringbuilder replace() - count how many replacements were made?

I'm using C# stringBuilder to replace string with the best performance, the the replace is never finish without informing the user how many replacements were made, but the Replace() method only return the stringBuilder instance, also I can't find…
123iamking
  • 2,387
  • 4
  • 36
  • 56
0
votes
2 answers

Groovy removing extra empty lines in StringBuilder Object

Trying to remove any extra empty lines beyond 2 empty lines in a file made from a StringBuilder. The code is in groovy so I seem to not understand why simple java procedure don't seem to work. Tried 3 things... Any suggestions? See code snippets…
kloklo90
  • 81
  • 1
  • 14
0
votes
2 answers

ToString - Formatting (String Builder)

Question: How do I make my string look like this, instead of this with (String Builder) What is Should Look Like: "Assassin's Creed IV: Black Flag", released on: Nov 29, 2013 "Child of Light", released on: May 01, 2014 "Dragon Age: Inquisition",…
0
votes
1 answer

How to compare StringBuilder tokens with multiple java strings?

My video will be published in all or any one or any two or any three of the below departments like Test1,Test2,Test3,Test4 etc... Programmatically I will fetch all the department names for my video and constructed as Java StringBuilder as…
Sakuntala
  • 1
  • 2
0
votes
0 answers

Data table to multiple CSV files

I'm fetching some records from SQL Server 2012 table. For that I've used DataTable. I want to write the fetched records to multiple CSV files. I've used StringBuilder to write the column headers and fields to CSV file (single CSV file). But, now the…
MD SARFARAZ
  • 117
  • 3
  • 17
0
votes
2 answers

C# : Given a string of a specified length replace chars in an array based on position and length

Given the following values which I am reading from an XML file: 00B50578 00A41434 00B50578 And, given the following string: string foo = "6F6F6F6F6F"; I’d like to somehow replace the characters which I am reading from the XML file with the…
0
votes
1 answer

Java: StringBuilder setCharAt not working properly

So I'm making a program where the case of each letter is inverted. If you enter "Hello", it outputs "hELLO". I'm aware that whatever I'm doing is not going to work, but I'm just not totally clear on WHY it won't work. public static void…
user230250
  • 131
  • 1
  • 10
0
votes
1 answer

Console Calendar with stringbuilder calendar sheet

I'm working on a console based calendar as an educational task (school). It needs to display a calendar sheet for the specific month the user enters. I'm almost there, but I noticed that now all months start on a monday. I created the sheet with a…
tweedledum11
  • 121
  • 9
0
votes
3 answers

How to append every X in c# stringbuilder

I'm using unity and c# and am not sure how to use stringbuilder to append a "/" every X characters. I have code and can build a string from a array with the code below, and add a comma after each string, but i need to add the "/" after every x…
Aboar
  • 5
  • 5
0
votes
1 answer

Saving StringBuilder in SQLiteDatabase

I can't seem to save a stringbuilder to my database file. I can't understand how ContentValues.putAll works as I think this is how I need to solve my problem. This is the code relevant to the issue. I think what I need to do is have a variable in…
0
votes
0 answers

Regex getting modified while passing from database to browser

I am trying to retrieve a regex expression from database and pass it on to client (Browser). But the regex expression is getting slightly modified in between due to intermidiate parsing and regex expression processing in C#. Can anyone please tell…
C V
  • 209
  • 1
  • 3
  • 13
0
votes
2 answers

Putting length to 0 for OutOfMemoryException of StringBuilder

I have a block of code which gets a file and appends require data as shown below: var srBuilder = new StringBuilder(); using (var file = new StreamReader(document.FullSourcePath, Encoding.ASCII)) { while…
Neel
  • 11,625
  • 3
  • 43
  • 61
0
votes
3 answers

Include null characters in C# StringBuilder string

I'm calling a C library function from a C# method; something like this: [DllImport("libfoo.dll")] public static extern int GetData(StringBuilder buffer); It returns the number of characters that it put into the buffer, and there's a known maximum…
tjr
  • 143
  • 1
  • 8
0
votes
1 answer

Getting AccessViolationException when passing a fixed length string from C# to a dll

I have the following (VB6?) code working perfectly in VBA for Excel. The dll that I am using (x.dll) is a "black box" to me. I don't know what it is written in, whether it is unmanaged or not. I know very little about it from an historical…
0
votes
2 answers

How to parse multipe json value in java

I've below json value in my StringBuilder variable, I want to parse all id key value and store it again in…
java begineer
  • 319
  • 5
  • 15
1 2 3
99
100