2,129 questions
0
votes
1
answer
102
views
How to Replace with StringBuilder from the right
I need to replace character sequences in a string, but they are not guaranteed not to be overlapping. The rule in case of conflicts is that ( first, the longest character sequence wins, but this is ...
0
votes
0
answers
70
views
Does string interpolation StringBuilder internally? [duplicate]
Note: this is not a duplicate of the question here. That one asks about string concatenation, which is different from string interpolation.
Consider this example of string creation in C#:
var str = $&...
4
votes
4
answers
269
views
Swap the first and the last words and reverse all the middle characters
Description
Guru gave a task to his students. He gave a sentence, and the students have to swap the first and the last words and reverse all the characters between those words. Help the students ...
0
votes
0
answers
38
views
What object should I store many strings in? [duplicate]
I have a process where I must (de)tokenize payment account information. Currently, when sending a file to client with payment information (among other things), the actual payment account numbers are ...
-1
votes
3
answers
150
views
Joining Strings into final String when the items are in StringBuilder
I have read about the StringBuilder API and StringJoiner API and String.join but not sure if I have items in StringBuilder instance, which call to use to do a join with a delimiter of choice. I do not ...
0
votes
0
answers
90
views
What Culture to use with StringBuilder to preserve functionality & performance, and avoid error CA1305
What Culture should I use with StringBuilder.Append to have similar functionality to this code:
StringBuilder sb = string.empty;
string str = ...;
sb.Append($"{str}BLABLA\n");
Is it really ...
2
votes
1
answer
145
views
How can I build a string that can pass null check but will throw null pointer exception when call str.length?
I met a quite strange case in a program with jdk1.8,
that I got a null pointer exception in String.length (which is in StringBuilder.append()) method,
the exact position of the null pointer exception ...
-1
votes
1
answer
104
views
Issue related to StringBuilder in Java
The Main Issue:
Can anyone please explain me why is this IDE is saying to create a constructor for using nextLine() function?
package Practice.String_9;
import java.util.*;
public class ...
0
votes
1
answer
95
views
how the append method of StringBuilder in Java works, and why the string passed to it as a parameter doesn't create a new string object in memory
StringBuilder sb = new StringBuilder("mainWord");
sb.append("secondWord" + "thirdWord");
System.out.println(sb);
The append method here accepts a String as a parameter. ...
0
votes
2
answers
984
views
How to decode extracted text from pdf file in android kotlin? [duplicate]
I'm new to Kotlin. I am creating an application in which, after the user selects/picks a PDF file, he will see fragments of the extracted text. Unfortunately each time I read text from the PDF file it ...
0
votes
1
answer
67
views
Tried to make a program that reconstructs numbers in string from a jumble string but got index out of bound error
Reconstruct Original Digits from English
Given a string s containing an out-of-order English representation of
digits 0-9, return the digits in ascending order.
I tried the code in Java but it ...
2
votes
1
answer
208
views
Unexpected Chinese Characters in StringBuilder Char array
This is more of a curiosity question. All our software & hardware on the network are UK based. I'm using the StringBuilder.AppendLine() method to build some basic CSV data for a download on a web ...
-1
votes
1
answer
405
views
StringBuilderPool Performance Benchmark Issue
In order to gain performance on the StringBuilder operations, I tried to apply the object pooling.
But pooling the StringBuilder seems to be slower than the original usage on both net8 and net7.
What ...
0
votes
0
answers
52
views
I am having problems with <script> tag not working when it is clearly there in the html body in the browser console [duplicate]
I have a jsp file which has an "iframe" tag where my data is shown when user searches for a field. When user clicks search, my servlet gets userdata from the database and create html page ...
1
vote
2
answers
83
views
Issue converting stringBuilder + forloop to stream + map
What I am trying to achieve:
I would like to convert a StringBuilder + forloop, like this:
public String question(List<MyPojo> myPojos) {
final StringBuilder stringBuilder = new ...