Replace Array String with Other Array String - java

same topic : replace String with another in java
I want to replace String Replace = "SUM(NewCounter)+SUM(NewCounter2)+NewCounter3";
I have Array A = {NewCounter, NewCounter2, NewCounter3}
say I have Array B = {test, testA, testB}
I want to replace it with array A with array B in String Replace.
I try to use method ReplaceAll(A.get(index), B.get(index));
Problem is:
NewCounter2 is Read by system "NewCounter"+2
so I have result = String Replace = "SUM(test)+SUM(test2)+test3";
I try to use ' in Character NewCounter, it will be Array A = {'NewCounter', 'NewCounter2', 'NewCounter3'}
but I must change String Replace Before like this :
String Replace = "SUM('NewCounter')+SUM('NewCounter2')+'NewCounter3'";
Is there other way to me ???
I don't want to change String before...
Thanksfull,
-mazipan-

The simplest solution for simultaneous replacement is to process the strings in order of decreasing length. This will do the replacements correctly:
A = {NewCounter3, NewCounter2, NewCounter}
B = {testB, testA, test}
This technique won't work if any of the search strings could match the replacement strings, however.
Edit: For the general case, I've written this:
public static String simultaneousReplace(String subject,
String[] find, String[] replace) {
if (find.length != replace.length) throw new IllegalArgumentException(
"Strings to find and replace are not paired.");
int numPairs = find.length;
StringBuilder sb = new StringBuilder();
for (int i = 0, len = subject.length(); i < len; i++) {
int longestMatchIndex = -1;
int longestMatchLength = -1;
for (int j = 0; j < numPairs; j++) {
String find1 = find[j];
if (subject.regionMatches(false, i, find1, 0, find1.length())) {
if (find1.length() > longestMatchLength) {
longestMatchIndex = j;
longestMatchLength = find1.length();
}
}
}
if (longestMatchIndex >= 0) {
sb.append(replace[longestMatchIndex]);
i += longestMatchLength - 1;
} else {
sb.append(subject.charAt(i));
}
}
return sb.toString();
}
Example usage:
String s = "SUM(NewCounter)+SUM(NewCounter2)+NewCounter3";
s = simultaneousReplace(s,
new String[] { "NewCounter", "NewCounter2", "NewCounter3" },
new String[] { "test", "testA", "testB" }
);
System.out.println(s);
Output:
SUM(test)+SUM(testA)+testB

If SUM is just a String and not a method then you can use:
String Replace = "SUM(" + NewCounter + ")SUM(" + NewCounter2 +")" + NewCounter3;
If Sum is a method then you can use
String Replace = SUM(NewCounter) + SUM(NewCounter2) + NewCounter3;
Although for the second one you may have to cast/convert to a string by surrounding it with
().toString()
or by adding
(String)()

Apache's commons-lang StringUtils#replaceEach handles these problems elegantly.
Runnable Code :
public static void main(String [] args) {
String replace = "SUM(NewCounter)+SUM(NewCounter2)+NewCounter3";
String [] a = { "NewCounter", "NewCounter2", "NewCounter3" };
String [] b = { "test", "testA", "testB" };
System.out.println(StringUtils.replaceEach(replace, a, b));
}
Will give you
SUM(test)+SUM(test2)+test3

Related

Split String from the last iteration

This post is an update to this one : get specific character in a string with regex and remove unused zero
In the first place, i wanted to remove with an regular expression the unused zero in the last match.
I found that the regular expression is a bit overkill for what i need.
Here is what i would like now,
I would like to use split() method
to get from this :
String myString = "2020-LI50532-3329-00100"
this :
String data1 = "2020"
String data2 = "LI50532"
String data3 = "3329"
String data4 = "00100"
So then i can remove from the LAST data the unused Zero
to convert "00100" in "100"
And then concatenate all the data to get this
"2020-LI50532-3329-100"
Im not familiar with the split method, if anyone can enlight me about this ^^
You can use substring method to get rid of the leading zeros...
String myString = "2020-LI50532-3329-00100";
String[] data = myString.split("-");
data[3] = data[3].substring(2);
StringBuilder sb = new StringBuilder();
sb.append(data[0] + "-" + data[1] + "-" + data[2] + "-" + data[3]);
String result = sb.toString();
System.out.println(result);
Assuming that we want to remove the leading zeroes of ONLY the last block, maybe we can:
Extract the last block
Convert it to Integer and back to String to remove leading zeroes
Replace the last block with the String obtained in above step
Something like this:
public String removeLeadingZeroesFromLastBlock(String text) {
int indexOfLastDelimiter = text.lastIndexOf('-');
if (indexOfLastDelimiter >= 0) {
String lastBlock = text.substring(indexOfLastDelimiter + 1);
String lastBlockWithoutLeadingZeroes = String.valueOf(Integer.valueOf(lastBlock)); // will throw exception if last block is not an int
return text.substring(0, indexOfLastDelimiter + 1).concat(lastBlockWithoutLeadingZeroes);
}
return text;
}
Solution using regex:
public class Main {
public static void main(String[] args) {
// Test
System.out.println(parse("2020-LI50532-3329-00100"));
System.out.println(parse("2020-LI50532-3329-00001"));
System.out.println(parse("2020-LI50532-03329-00100"));
System.out.println(parse("2020-LI50532-03329-00001"));
}
static String parse(String str) {
return str.replaceAll("0+(?=[1-9]\\d*$)", "");
}
}
Output:
2020-LI50532-3329-100
2020-LI50532-3329-1
2020-LI50532-03329-100
2020-LI50532-03329-1
Explanation of the regex:
One or more zeros followed by a non-zero digit which can be optionally followed by any digit(s) until the end of the string (specified by $).
Solution without using regex:
You can do it also by using Integer.parseInt which can parse a string like 00100 into 100.
public class Main {
public static void main(String[] args) {
// Test
System.out.println(parse("2020-LI50532-3329-00100"));
System.out.println(parse("2020-LI50532-3329-00001"));
System.out.println(parse("2020-LI50532-03329-00100"));
System.out.println(parse("2020-LI50532-03329-00001"));
}
static String parse(String str) {
String[] parts = str.split("-");
try {
parts[parts.length - 1] = String.valueOf(Integer.parseInt(parts[parts.length - 1]));
} catch (NumberFormatException e) {
// Do nothing
}
return String.join("-", parts);
}
}
Output:
2020-LI50532-3329-100
2020-LI50532-3329-1
2020-LI50532-03329-100
2020-LI50532-03329-1
you can convert the last string portion to integer type like below for removing unused zeros:
String myString = "2020-LI50532-3329-00100";
String[] data = myString.split("-");
data[3] = data[3].substring(2);
StringBuilder sb = new StringBuilder();
sb.append(data[0] + "-" + data[1] + "-" + data[2] + "-" + Integer.parseInt(data[3]));
String result = sb.toString();
System.out.println(result);
You should avoid String manipulation where possible and rely on existing types in the Java language. One such type is the Integer. It looks like your code consists of 4 parts - Year (Integer) - String - Integer - Integer.
So to properly validate it I would use the following code:
Scanner scan = new Scanner("2020-LI50532-3329-00100");
scan.useDelimiter("-");
Integer firstPart = scan.nextInt();
String secondPart = scan.next();
Integer thirdPart = scan.nextInt();
Integer fourthPart = scan.nextInt();
Or alternatively something like:
String str = "00100";
int num = Integer.parseInt(str);
System.out.println(num);
If you want to reconstruct your original value, you should probably use a NumberFormat to add the missing 0s.
The main points are:
Always try to reuse existing code and tools available in your language
Always try to use available types (LocalDate, Integer, Long)
Create your own types (classes) and use the expressiveness of the Object Oriented language
public class Test {
public static void main(String[] args) {
System.out.println(trimLeadingZeroesFromLastPart("2020-LI50532-03329-00100"));
}
private static String trimLeadingZeroesFromLastPart(String input) {
String delem = "-";
String result = "";
if (input != null && !input.isEmpty()) {
String[] data = input.split(delem);
StringBuilder tempStrBldr = new StringBuilder();
for (int idx = 0; idx < data.length; idx++) {
if (idx == data.length - 1) {
tempStrBldr.append(trimLeadingZeroes(data[idx]));
} else {
tempStrBldr.append(data[idx]);
}
tempStrBldr.append(delem);
}
result = tempStrBldr.substring(0, tempStrBldr.length() - 1);
}
return result;
}
private static String trimLeadingZeroes(String input) {
int idx;
for (idx = 0; idx < input.length() - 1; idx++) {
if (input.charAt(idx) != '0') {
break;
}
}
return input.substring(idx);
}
}
Output:
2020-LI50532-3329-100

Split Word into Two and Check Existence in Comma Separated String Sequence

I have a string array for example:
new String[] = {"powerhouse", "p, pow, power, house, pose, poser"};
My goal is to split the first entry in the array in this case powerhouse into any two words and check them against the second entry, which serves as a dictionary of words.
Here's my implementation so far:
public static String[] convertWordsToArray(String input){
String[] wordArr = null;
wordArr = input.split(",");
return wordArr;
}
public static String splitEm(String[] strArr) {
String fw = strArr[0];
String sw = strArr[1];
String[] arrOne = convertWordsToArray(fw);
System.out.println(arrOne.length);
String[] dict = convertWordsToArray(sw);
System.out.println(dict.length);
for(int i = 0; i < dict.length - 1; i++) {
String mWord = fw.split(i, i + 1);
System.out.println(mWord);
}
// Edit Starts Here, tried to substring it but nothing prints in log
for(int i = 0; i < arrOne.length; i++) {
String mWord = fw.substring(0, i);
System.out.println(mWord);
}
return ""; // empty for now
}
I am stuck at the part where the first word has to be split. Should I use two loops, one for the first word and the other for the dictionary? I know that somehow the dictionary has to be converted to a list or array list to avail the .contains() method. How do I go about this? Thanks.
If anyone want the solution for PHP language, then you can use below code:
function ArrayChallenge($strArr) {
$dictWords = explode( ',', $strArr[1] );
$strLength = strlen($strArr[0]);
$output = 'not possible';
for( $i = 1; $i < $strLength; $i++ ){
$firstStr = substr($strArr[0], 0, $i);
$lastStr = substr($strArr[0], $i, $strLength);
if ( in_array( $firstStr, $dictWords ) && in_array( $lastStr, $dictWords ) ) {
$output = $firstStr . ',' . $lastStr;
break;
}
}
return $output;
}
Do you need something like this?
String s = "powerhouse";
List<String> list = new ArrayList<String>();
for(int i = 0; i < s.length(); i++){
for(int j = i+1; j <= s.length(); j++){
list.add(s.substring(i,j));
}
}
System.out.println(list);
I assume you need something like below:
Split second string at each , or even better using regex to trim
spaces before or after ,
check if each part of the splited entry fro above point is made of
only the chars contained in the first entry of your input
example
public static void main(String args[]) {
String[] test1 = {"powerhouse", "p, pow, power, house, pose, poser"};
String[] test2 = {"powerhouse", "p, xyz, power, house, pose, poser"};
System.out.println(check(test1));
System.out.println(check(test2));
}
static boolean check(String[] input){
String firstEntry = input[0];
String[] dictionary = input[1].split("\\s*,\\s*");
for(int i = 0; i < dictionary.length; i++){
if(!dictionary[i].matches("["+firstEntry+"]+")){
return false;
}
}
return true;
}
this will print true for the first case and false for the second as "xyz" is not a valid subpart/substring according to your discription
Try this :
public class Stack {
public static void main(String[] args) {
String[] str = {"powerhouse", "p, pow, power, house, pose, poser"};
String firstPart = str[0];
String secondPart = str[1];
boolean contain = isContain(firstPart, secondPart);
System.out.println(contain);
}
private static boolean isContain(String firstPart, String secondPart) {
for (int i = 0; i < firstPart.length(); i++) {
String firstWord = firstPart.substring(0, i);
String secondWord = firstPart.substring(i, firstPart.length());
List<String> strings = Arrays.asList(secondPart.trim().split("\\s*,\\s*"));
if (strings.contains(firstWord) && strings.contains(secondWord)) return true; if you want to check both words use this
//if (strings.contains(firstWord) || strings.contains(secondWord)) return true; if you want to check any(one) word from two words use this
}
return false;
}
}

Remove null from unused space of StringArray when converting to a string in Java

I was working on a Java coding problem and encountered the following issue.
Input: A String -> "Code"
Output Expected: A string -> CCoCodCode
My Code snippet: (Note: In comments I have written what I expect upon passing the string)
public String stringSplosion(String str) { // string Say 'Code'
String join = "", values = "";
String gotIt = "";
int n = str.length(); // 4
int size = 0;
for (int i = n; i >= 1; i--) {
size = size + n; // 4+3+2+1=10
}
String[] result = new String[size];
for (int i = 0; i < str.length(); i++) {
values = str.substring(i, i + 1);
join = join + values;
result[i] = join;
}
for (String s : result) {
gotIt = gotIt + s;
}
return gotIt; // Expected output: CCoCodCode
}
Output I am getting:
CCoCodCodenullnullnullnullnullnullnullnullnullnullnullnull
Why is null getting stored although I have reduced the size and how can I remove it?
NOTE: I need to solve this using arrays. I know it is much easier using List.
If you want to keep the current structure of your code, get rid of the first for loop.
And create String[] array = new String[n]
public static String stringSplosion(String str) { // string Say 'Code'
String join = "", values = "";
String gotIt = "";
int n = str.length(); // 4
String[] result = new String[n]; //you want your String array to contain 4 strings
for (int i = 0; i < str.length(); i++) {
values = str.substring(i, i + 1);
join = join + values;
result[i] = join;
}
for (String s : result) {
gotIt = gotIt + s;
}
return gotIt; // Expected output: CCoCodCode
}
public class Answer {
public static String answer(String input){
StringBuilder sb = new StringBuilder(((input.length() + 1) * input.length()) / 2);
for (int i = 1; i <= input.length(); i++) {
sb.append(input.substring(0, i));
}
return sb.toString();
}
public static void main(String[] args) {
System.out.println(answer("Code"));
}
}
Below statements are not required:
int size = 0;
for (int i = n; i >= 1; i--) {
size = size + n; // 4+3+2+1=10
}
You just need to change the array size from
String[] result = new String[size];
to
String[] result = new String[n];
for your program to give the expected output.
If I understand ur problem correctly to print the pattern then u can use below code,
public String printPattern(String input){
//Holds the iteration value by index
int previous=0;
//It holds the result characters
String result=null;
StringBuilder strBuilder=new StringBuilder();
//first loop to iterate only till input string length
for(int i=0;i<input.length();i++){
//checking iteration lenght with input string length
if(previous<input.length()){
//incrementing iteration for reading characters from input string
previous++;
//main loop for previous iteration value check and iterate
for(int j=0;j<previous;j++){
//converting string to Character array
char a []=input.toCharArray();
//using string builder to build the string from characters
strBuilder.append((a[j]));
//setting the value to stringbuilder by converting it in string
result=strBuilder.toString();
}
}
}
return result;
}
Size should be the length of string. Code's length is 4. Code will produce {C, Co, Cod, Code}.
public String stringSplosion(String str) { // string Say 'Code'
String join = "", values = "";
String gotIt = "";
int n = str.length(); // 4
String[] result = new String[n];
for (int i = 0; i < str.length(); i++) {
values = str.substring(i, i + 1);
join = join + values;
result[i] = join;
}
System.out.println(Arrays.toString(result));
for (String s : result) {
gotIt = gotIt + s;
}
return gotIt; // Expected output: CCoCodCode
}
String input = "Code";
String output[] = IntStream.range(0, input.length()+1)
.mapToObj(i -> input.substring(0, i))
.toArray(String[]::new);

How to convert string to array (int and string array).?

How can I get the String and the int values from a String like this : "a:10,b:15,c:20,d:30"
String mixedString = "a:10,b:15,c:20,d:30";
String requiredArray1[] = [a,b,c,d];
int requiredArray2[] = [10,15,20,20];
You can loop your String and test your String one by one:
First
You need to split your String to :
String myString = "a:10,b:15,c:20,d:30";
//split the String to get only the Strings and int in your case you need to split with , and :
String mixedString[] = myString.split(":|\\,");
Second
Test If the String is Integer then return true and insert it to the array of Integers, else Insert it to the array of Strings:
public static boolean test(String s){
try{
Integer i = Integer.parseInt(s);
return true;
}catch(Exception e){
return false;
}
}
Here how your program should look like:
public static void main(String[] args) {
String myString = "a:10,b:15,c:20,d:30";
String mixedString[] = myString.split(":|\\,");
String requiredArray1[] = new String[mixedString.length];
int requiredArray2[] = new int[mixedString.length];
int s = 0;
int n = 0;
for (int i = 0; i < mixedString.length; i++) {
if (!test(mixedString[i])) {
requiredArray1[s] = mixedString[i];
s++;
} else {
requiredArray2[n] = Integer.parseInt(mixedString[i]);
n++;
}
}
}
public static boolean test(String s) {
try {
Integer i = Integer.parseInt(s);
return true;
} catch (Exception e) {
return false;
}
}
If your mixed String is as you show in your post where every alpha character is always followed by a colon delimiter (:) and then a string representation of a numerical value, you really don't need an additional method to test for whether or not a numerical value is there. You simply know its there just as you know there is a alpha value there as well...or...maybe you don't and maybe you should test for the alpha as well. You don't specify either way within your post what different possibilities might exist within the mixed string. Therefore, we can assume that:
Every alpha section is delimited with a colon (:) and then followed by a string representation of a numerical value which so far does indeed appear to be Integer. This is then followed by a comma (,) delimiter and yet another colon delimited alpha/numerical pair.
String mixedString = "a:10,b:15,c:20,d:30";
System.out.println("Original String: \"" + mixedString + "\"\n");
String[] mStringArray= mixedString.split(",");
String[] alphaArray = new String[mStringArray.length];
int[] numericArray = new int[mStringArray.length];
for (int i = 0; i < mStringArray.length; i++) {
String[] tmp = mStringArray[i].split(":");
alphaArray[i] = tmp[0];
numericArray[i] = Integer.parseInt(tmp[1]);
}
// Display contents of the two Arrays
System.out.println("Elements From Alpha Array");
for (int i = 0; i < alphaArray.length; i++) {
System.out.println(alphaArray[i]);
}
System.out.println("\nElements From Numeric Array");
for (int i = 0; i < numericArray.length; i++) {
System.out.println(numericArray[i]);
}
public static void main(String[] args) {
String myString = "a:10,b:15,c:20,d:30";
// extract all numbers (All elements are numbers so you can convert it to int easily )
String[] requiredArray1 = extractAllAccordingToRegex("\\d+", myString);
// extract all characters
String[] requiredArray2 = extractAllAccordingToRegex("[a-zA-Z]+",myString);
}
static String[] extractAllAccordingToRegex(String inputRegex, String input) {
List<String> extractedItems = new ArrayList<String>();
Pattern reg = Pattern.compile(inputRegex);
Matcher m = reg.matcher(input);
while (m.find()) {
extractedItems.add(m.group());
}
return extractedItems.toArray(new String[1]);
}

To add commas in file

This is my first question in this forum...
I have a file with numerous data fields (both numeric and characters) in the file.
I want to delimit the file with set of delimiter length like 2,5,1,9,6 etc.
(Alternatively: I have a list of field lengths such as 2,5,1,9,6, and I want to insert comma delimiters in (a copy of) the source string after each field.)
For example, if my file is like this:
9483trdcvge245621jde
then I need to insert commas at 2,5,1,9,6 etc.
and the output will be:
94,83trd,c,vge245621,jde,
I need to do this in JAVA
Please help me to solve this issue.
Thanks in advance
if (myString.equals("9483trdcvge245621jde")) {
myString = "94,83trd,c,vge245621,jde";
}
Jokingly ;-)
I think something like this...
private static final int[] pos = {2, 5, 1, 9, 6};
private static final String DIV = ",";
public static String parse(String str) {
int start = 0;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < pos.length; i++) {
if (i > 0) {
sb.append(DIV);
}
int end = start + pos[i];
if (end <= str.length()) {
sb.append(str.substring(start, end));
start = end;
} else {
sb.append(str.substring(start));
}
}
return sb.toString();
}
Read in the file as a StringBuilder then use something like this
StringBuilder sb = new StringBuilder(file); //The string builder
while (/*the string builder isn't finished*/)
{
int position = ;//The position you want the comma at 2 or 4 or whatever
sb.insert(position, ",");
}
Loop through as many times as needed.
I think i would do it this way
str being the input string
pos being the lengths of the parts after which we should put a comma
Code:
public static String partition(String str, int[] pos) {
int oldPos = 0;
StringBuilder builder = new StringBuilder(str.length() + pos.length);
for(int len : pos) {
builder.append(str.substring(oldPos, oldPos+len)).append(',');
oldPos += len;
}
builder.append(str.substring(oldPos)).append(',');
return builder.toString();
}
I think I don’t understand the question. Read the file, line by line, and insert commas into the string.
String newString = line.substring(0, firstComma) + "," + line.substring(firstComma + 1);
Of course this is terribly inefficient and can be optimized in numerous ways.
Assuming you have all these as Strings you can use String.substring(start, end). Then simply append + the substrings and commas together.
String data = "9483trdcvge245621jde";
String result = "";
result += data.substring(0,2) + ",";
result += data.substring(2, 7) + ",";
result += data.substring(7, 8) + ",";
etc...
Note: Using + to append string like this is very slow as it reallocates and moves data around each time. There are faster ways to concatenate Strings if speed is an issue.
String newString = "";
int[] positions = { 2, 5, 1, 9, 6 }; //etc
for (int i = 0; i > positions.length; i++) {
String tempString = "";
if (i == positions.length) { //for the last item
tempString = oldString.substring(0, positions[i]);
}
else { //every item except the last item
tempString = oldString.substring(0, positions[i]) + ",";
}
oldString = oldString.substring(positions[i]);
newString += tempString;
}
Stored the positions in an array. Iterate through, adding the delimited strings to a new string and removing them from the old one.
This might not be the best way, but its how I would do it. :P
Here's one solution:
package com.foo;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Commafy {
public static final String SEPARATOR = ",";
private static void fail(String message) {
System.err.println(message);
System.exit(1);
}
private static int[] argsAsInts(String[] args) {
if (args.length < 2) {
fail("argument list of file name followed by field lengths is required");
}
int[] result = new int[args.length - 1];
for (int i = 1; i < args.length; ++i) {
try {
result[i - 1] = Integer.parseInt(args[i]);
} catch (NumberFormatException nfe) {
fail("can't convert argument \"" + args[i] + "\" to integer");
}
}
return result;
}
private static int[] partialSums(int[] lengths) {
int[] result = new int[lengths.length];
int start = 0;
for (int i = 0; i < lengths.length; ++i) {
result[i] = start;
start += lengths[i];
}
return result;
}
private static int[] fieldsEndAt(int[] lengths, int[] starts) {
int[] result = new int[lengths.length];
for (int i = 0; i < lengths.length; ++i) {
result[i] = starts[i] + lengths[i];
}
return result;
}
private static void process(
String fileName, int[] starts, int[] ends
) throws IOException {
BufferedReader br = new BufferedReader(
new FileReader(fileName)
);
final int MIN_LENGTH = ends[ends.length - 1];
String line = br.readLine();
while (line != null) {
if (line.length() < MIN_LENGTH) {
System.err.println("short input line \"" + line +"\" skipped");
} else {
StringBuilder sb = new StringBuilder();
String separate = "";
for (int i = 0; i < starts.length; ++i) {
sb.append(separate).append(line.substring(starts[i], ends[i]));
separate = SEPARATOR;
}
System.out.println(sb.toString());
}
line = br.readLine();
}
br.close();
}
public static void main(String[] args) {
int[] lengths = argsAsInts(args);
int[] starts = partialSums(lengths);
int[] ends = fieldsEndAt(lengths, starts);
try {
process(args[0], starts, ends);
} catch (IOException e) {
fail("I/O Exception while processing input");
}
}
}
Given a data file named data/fixedlengthdata.text containing:
9483trdcvge245621jde
9483trdcvge245621jdelong
9483trdcvge245621
9483trdcvge245621jde
and run with arguments of:
data/fixedlengthdata.text 2 5 1 9 3
it produces output of:
94,83trd,c,vge245621,jde
94,83trd,c,vge245621,jde
short input line "9483trdcvge245621" skipped
94,83trd,c,vge245621,jde
(where the third line above goes to stderr, of course.)
This is probably the most bizzare requirement that I've ever seen, but anyway...
Psuedo-code
Collection<Integer> indexes; // initialized with indexes to add commas at
StringBuilder bldr = new StringBuilder();
for (int i = 0; i < inString.length(); i++){
bldr.append(inString.charAt(i));
if (indexes.contains(i))
bldr.append(",");
}
return bldr.toString();

Categories

Resources