Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6833999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:03:25+00:00 2026-05-26T23:03:25+00:00

String SomeLongString = JavaAPIMethodFor (String[] strings, String delimiter); Or this could work as well:

  • 0
String SomeLongString = JavaAPIMethodFor (String[] strings, String delimiter);

Or this could work as well:

String SomeLongString = JavaAPIMethodConvertingArrayWithDelimeter (String[] strings, char delimiter)

I wanted to join strings into a larger string, but this is simply useless. I am aware that I could append all the data into a string using Arrays.toString(Object someString) then adjust the string, removing unwanted characters. But that’s not really efficient, building something, only to rebuild it. So looping through the String[] and adding my character[s] between each element is probably the way to go:

import static org.junit.Assert.*;

import org.junit.Test;

public class DelimetedString {


    private String delimitedString(String [] test, String delimiter){
        StringBuilder result = new StringBuilder();
        int counter = 0;
        if(test.length > counter){
           result.append(test[counter++]);
           while(counter < test.length){
              result.append(delimiter);
              result.append(test[counter++]);
           }
        }
        return result.toString();
    }

    @Test
    public void test() {
        String [] test = new String[] 
{"cat","dog","mice","cars","trucks","cups","I don't know", "anything!"};
        String delimiter = " |...| ";
        assertEquals("DelimitedString misformed",
        "cat |...| dog |...| mice |...| cars |...| trucks "
            +"|...| cups |...| I don't know |...| anything!",
        delimitedString(test, delimiter));
    }

}

What I wanted was something to put together a string after using a tokenizer. I abandoned that Idea, since it’s probably more cumbersome then it’s worth. I chose to address a Sub-Strings from within the larger String, I included the code for that, in an “answer”.

What I was asking is – Does the java API have an equivalent function as the delimitedString function? The answer from several people seems to be no.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:03:26+00:00Added an answer on May 26, 2026 at 11:03 pm

    As far as I know, there isn’t a built in method. What you can do is taking the substring of it:

    String str = Arrays.toString(arrayHere);
    str = str.substring(1, str.lenght() - 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

string queryString = SELECT SUM(skupaj_kalorij)as Skupaj_Kalorij + FROM (obroki_save LEFT JOIN users ON obroki_save.ID_uporabnika=users.ID)
string data = 0000062456 how to split this string on 5 pieces so that
String myQuery1 = insert into mytable(mycol) values(myval) \ngo; String myQuery2 = insert into mytable(mycol)
string sqlInsert = Insert into account_details( account_number, account_type, transfer_access_code, account_balance, customer_id) SELECT account_number, account_type,
string GetLine() { char parameter[26] = {NULL}; inFile.getline (parameter,26,' '); return parameter; } Now
string[] ssss = 1,2,,3.Split(new[] {','}) .Where(a=>!string.IsNullOrEmpty(a)) .Select(); How does this works?
string insertCommand = INSERT INTO Users (UserID) VALUES ('+UsersIdentityToinsert+'); //Exception: Cannot insert the value
String.prototype.getLanguage = function() { $.getJSON('http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&q=' + this + '&callback=?', function(json) { return json.responseData.language; });
string to build up using keyvaluepair is like this: name1=v1&name2=v2&name3=v3 what i am doing:
String.fromCharCode(72) gives H. How to get number 72 from char H?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.