Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashSet;

import java.util.Set;

public class Main {

    //@formatter:on
    public static String removeRepeat(String s) {
        Set<Object> tempSet = new HashSet<Object>();
        String[] t = s.split(",");
        for (int i = 0; i < t.length; i++) {
            tempSet.add(t[i]);
        }
        Object[] tempObject = tempSet.toArray();
        String temp = "";
        for (int i = 0; i < tempObject.length; i++) {
            temp += tempObject[i] + ",";
        }
        return temp;
    }
}