Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
102 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
0 votes
0 answers
70 views

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 = $&...
user3163495's user avatar
  • 4,046
4 votes
4 answers
268 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
0 votes
0 answers
38 views

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 ...
George's user avatar
  • 2,212
-1 votes
3 answers
150 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
0 votes
0 answers
89 views

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 ...
PhantomR's user avatar
  • 595
2 votes
1 answer
145 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,345
-1 votes
1 answer
104 views

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 ...
Abhishek Yadav's user avatar
0 votes
1 answer
92 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
2 answers
978 views

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 ...
ollo's user avatar
  • 983
0 votes
1 answer
67 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
2 votes
1 answer
208 views

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 ...
Bluetonic's user avatar
-1 votes
1 answer
401 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
0 votes
0 answers
52 views

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 ...
DamanS's user avatar
  • 1
1 vote
2 answers
80 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,478
1 vote
1 answer
107 views

I need some suggestion on using StringBuilder as against String inside function parameters. The basic structure of my program is as below : There are several functions running sequentially . Based on ...
somnath's user avatar
  • 41
0 votes
1 answer
262 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
1 vote
2 answers
222 views

What am trying to do here is to improve speed performance by using StringBuilder outside the loop and clear StringBuilder in each cycle for reuse , but seems like this approach doesn't always work , ...
DAN's user avatar
  • 27
0 votes
3 answers
84 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
0 votes
4 answers
98 views

I am solving the 125. Valid Palindrome problem in leetcode. For testcase A man, a plan, a canal: Panama with below code, it is returning false: class Solution { public boolean isPalindrome(...
BALLA HARSHA's user avatar
-2 votes
1 answer
100 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
1 vote
0 answers
43 views

We just started Java at school and I was wondering why this search algorithm isn't working: the purpose of the entire code is to store N wine bottles (object) in a cellar (array) and to search for the ...
Lorelius Hogglefart's user avatar
0 votes
0 answers
204 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
1 answer
150 views

I'm a mechanician who has to develop tools yo manage xml files. I have an issue and I need your help. One of my xml file that I have to manage has several roots. Don't ask why, my provider will not ...
Cesar's user avatar
  • 1
0 votes
0 answers
54 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
-2 votes
1 answer
75 views

I have this method that returns a string where a triangle appears on the left size of the diagram, followed by horizontal lines. I used a stringBuilder for this method. The problem is that there is an ...
George's user avatar
  • 1
0 votes
0 answers
53 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
0 votes
2 answers
77 views

So I am trying to make a Simon Says game where the user would have to repeat what the console has shown back to it. So for me so far I have made it work so that the characters have been showcased to ...
Lmar Momand's user avatar
-2 votes
3 answers
224 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
0 votes
1 answer
41 views

I have this program that has a C# controller that uses StringBuilder to write to a CSV file which would be downloaded when clicked. Here's my C# function: public ActionResult GenerateCSV() { ...
Prashant Potluri's user avatar
-1 votes
1 answer
919 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
-2 votes
2 answers
74 views

I'm trying to initialize a StringBuilder with "". These are 2 samples, the first one doesn't work while the second one works. Can anyone explain a bit more? Is this because StingBuilder is ...
hello xx's user avatar
0 votes
2 answers
132 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
3 answers
156 views

Here is the question: Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s. A shift on s consists of moving the leftmost character of s to the ...
Aditya Simant's user avatar
0 votes
0 answers
75 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
2 votes
2 answers
339 views

I'm new in .net platform and I'm curious about how can I pass js function with curly brackets as string inside StringBuilder.AppendFormat() c#.here is what I'm willing to do StringBuilder sb = new ...
Ram Khatri's user avatar
0 votes
2 answers
547 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
2 votes
3 answers
222 views

Does Java Set contains() know how to check for the existence of StringBuilder? I am running this problem in Leetcode. "Find Unique Binary String". Note this Question is not about Solving the ...
mattsmith5's user avatar
  • 1,357
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
-1 votes
1 answer
71 views

I need to ensure that always at the end of this string when there is a password, from there it leaves the password masked and does not display. Remembering that in the end, the value cannot always be ...
Luiz Ricardo Cardoso's user avatar
0 votes
1 answer
84 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
0 votes
2 answers
547 views

I am dynamically building a SQL statement using StringBuilder. The criteria are defined by the user and there is no limit. There is no problem with the string format, it is generated fine. Let's say ...
Federico's user avatar
  • 121
-2 votes
1 answer
279 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
-3 votes
3 answers
1k views

I need to assign a new string value to completely replace the existing string value in a StringBuilder object. But, sb.Append() will only add to the end of a string, and sb.Insert(0,stringVal) will ...
KWallace's user avatar
  • 1,730
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
-3 votes
1 answer
87 views

import java.util.Scanner; public class ValidString { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter the String: &...
user avatar
-4 votes
2 answers
477 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
2 votes
1 answer
120 views

So I have created my first Azure Function (4.0) (.NET 7.0) that takes an input text file from an Azure Storage Blob Container, does some processing on it, then generates additional text files based on ...
AJ Brockson's user avatar
0 votes
1 answer
109 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
-2 votes
1 answer
101 views

From the description of StringBuilder class: private int GetReplaceBufferCapacity(int requiredCapacity) { // This function assumes that required capacity will be less // than the ...
Humble Newbie's user avatar

1
2 3 4 5
43