---
title: "A method to reverse effect of java String.split()?"  
description: "A method to reverse effect of java String.split()?"  
author: "Anonymous User"  
published: 2013-09-28  
updated: 2013-09-28  
canonical: https://www.mindstick.com/forum/1558/a-method-to-reverse-effect-of-java-string-split  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# A method to reverse effect of java String.split()?

I [am looking](https://answers.mindstick.com/qa/115463/i-am-looking-for-to-joining-the-mindstick-internship-program-how-to-apply) for a [method](https://www.mindstick.com/forum/166/webservice-method) to [combine](https://www.mindstick.com/interview/1043/how-can-i-combined-two-variable-together) an [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) of [strings](https://www.mindstick.com/forum/161912/explain-the-python-strings) into a delimited String. An opposite to [split](https://www.mindstick.com/blog/11920/top-3-voltas-split-acs-for-your-home)(). I've seen this in other languages.\

Wanted to ask the [forum](https://www.mindstick.com/forum/156327/what-is-forum-posting) before I try [writing](https://www.mindstick.com/articles/12997/5-essential-tips-on-resume-writing-for-business-analysts) my own( since the [JDK](https://www.mindstick.com/forum/33789/java_home-does-not-point-to-the-jdk) has everything...)

Thanks,

## Replies

### Reply by Anonymous User

Hey Pravesh!

Based on all the previous answers:

```
public static String join(Iterable<? extends Object> elements, CharSequence separator){    StringBuilder builder = new StringBuilder();    if (elements != null)    {        Iterator<? extends Object> iter = elements.iterator();        if(iter.hasNext())        {            builder.append( String.valueOf( iter.next() ) );            while(iter.hasNext())            {                builder                    .append( separator )                    .append( String.valueOf( iter.next() ) );            }        }    }    return builder.toString();
}
```

\


---

Original Source: https://www.mindstick.com/forum/1558/a-method-to-reverse-effect-of-java-string-split

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
