Loading
DelimitedStringFromArray

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  getDelimitedString


Ans)

This method converts the Array to a Delimited separates String
that could be Comma or some other delimitor.

 static public String getDelimitedString(String[] array, String delim) {
        String str = "";
        if (array != null) {
            for (int i = 0; i < array.length; i++) {
                if (!array[i].trim().equals("")
                        && !array[i].trim().equals("-1")) {
                    str += array[i];
                    str += delim;
                }
            }
            // stripping the last comma if one exists.
            if(str.trim().endsWith(",")){
             str = str.substring(0, str.length()-1);
            }
           
        }
        return str;
    }



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

DelimitedStringFromArray


DelimitedStringFromArray

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free