Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
1 answer
98 views

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 ...
Vladimirs Kacs's user avatar
4 votes
4 answers
264 views

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 ...
MARTIN 's user avatar
-1 votes
3 answers
148 views

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 ...
curiousengineer's user avatar
2 votes
1 answer
141 views

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 ...
Mobility's user avatar
  • 3,355
0 votes
1 answer
81 views

StringBuilder sb = new StringBuilder("mainWord"); sb.append("secondWord" + "thirdWord"); System.out.println(sb); The append method here accepts a String as a parameter. ...
Rufat Rustamli's user avatar
0 votes
1 answer
62 views

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 ...
Aryan Kaushik's user avatar
-1 votes
1 answer
382 views

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 ...
HighHopes's user avatar
1 vote
2 answers
72 views

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 ...
PatPanda's user avatar
  • 5,418
0 votes
1 answer
248 views

I am creating a calendar event using powershell. Ideally, I'd like to avoid using modules if possible because I feel like what I'm trying to do is very possible with what I have, but if a module is my ...
Koobah84's user avatar
  • 185
0 votes
3 answers
81 views

I am trying to add all the elements of an int array brr into a StringBuilder res using the following code: StringBuilder res = new StringBuilder(); Arrays.stream(brr).forEach(res::append); I want ...
Habibur Rahman's user avatar
-2 votes
1 answer
93 views

I used a StringBuilder to write an SQL query in .NET. After I perform the query, is there a point in manually setting the contents of the string to ""? I'm guessing this is already being ...
Parrotmaster's user avatar
0 votes
0 answers
199 views

I am working on a school project and the task was to create an application, which one of the features is to save multi-lined text (user input) into a string. I know some parts of the code might be ...
Lamecode0's user avatar
0 votes
0 answers
48 views

I have a scenario to read zip files from a server URL. But I get a Java heap error when i append the string in the stringbuilder public static void main(String args[]) { String url = &...
Watermelon's user avatar
0 votes
0 answers
49 views

so im very new to programing and was tasked to send an email. the email gets sent. but it seems im either not using the html. or im rewriting or deleting it somehow. can someone give me a hand to ...
Carlos Rozo's user avatar
-2 votes
3 answers
217 views

I have a problem: I need to get a phone number as a string "79991111111" and convert it to this type of string "+7 (999) 111-11-11". As i got it i'm able to do it by using a String....
komezh's user avatar
  • 13
-1 votes
1 answer
898 views

If i have an AtomicReference to a StringBuilder defined as so: private AtomicReference<StringBuilder> stringBuffer = new AtomicReference<>(new StringBuilder()); which method is best for ...
anon comp's user avatar
  • 153
0 votes
2 answers
119 views

I'm fairly new to Java and stackoverflow. Please alert me if I make a mistake or if I provide insufficient information. I'm working on a Java Swing project and trying to use a custom DocumentFilter ...
Nichti's user avatar
  • 1
0 votes
0 answers
64 views

I want to compress the string using StringBuilder but the code is not working as expected. It is simply returning the print statement. import java.util.*; public class string_compression { public ...
Yash Tambi's user avatar
0 votes
2 answers
528 views

Java version: openjdk 11.0.19 When I was looking at the source code of StringBuilder, I noticed that it checks if the capacity exceeds 2147483639 when you use the append method. I'm curious why this ...
TdOnline's user avatar
0 votes
1 answer
1k views

I am trying to create a csv string from a list of GUIDs (around 10000) of them. My snippet is below. private string GetAppInformationForCache() { StringBuilder appInfo = new (); var ...
Programmerzzz's user avatar
0 votes
1 answer
79 views

according to the theory after manupaliting string using String Builder keyword both memory address must be same, but i get wrong answer. could anyone please explain this. class Program { ...
Malaka's user avatar
  • 1
-2 votes
1 answer
278 views

class Solution { public String mergeAlternately(String word1, String word2) { int length = word1.length() + word2.length(); StringBuilder ans = new StringBuilder(length); ...
21SCS34 Arumugaperumal's user avatar
0 votes
4 answers
111 views

I am trying to replicate this code using StringBuilder but can't figure out how. What this does is check a given string (tweetText) with an array of Strings (usernames) and if is a match replaces the ...
Jorge D. García's user avatar
-4 votes
2 answers
474 views

I am constructing single string value based on some other string details, which is as below. But don't wants to add if any of DTO value is null or empty. How can I add it in java. String dummyVal = ...
Kesavan Balakrishnan's user avatar
0 votes
1 answer
108 views

StringBuilder sb = new StringBuilder("test", 4); sb.Append('\n'); sb.AppendLine("test1"); sb.AppendLine("test2"); sb.AppendLine("test3"); sb.AppendLine("...
Humble Newbie's user avatar

1
2 3 4 5
43