Java String Split getUsedInputs(String expression)

Here you can find the source of getUsedInputs(String expression)

Description

get Used Inputs

License

Open Source License

Declaration

public static String getUsedInputs(String expression) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static String getUsedInputs(String expression) {
        List<String> usedInputsList = new ArrayList<>();

        Pattern pattern = Pattern.compile("\\w+");
        Matcher matcher = pattern.matcher(expression);

        String currentString;//from w  ww .j a v a 2  s. c  om
        while (matcher.find()) {
            currentString = matcher.group();
            if (!usedInputsList.contains(currentString))
                usedInputsList.add(currentString);
        }
        Collections.sort(usedInputsList);

        return String.join(" ", usedInputsList);
    }
}

Related

  1. getInputs(String str)
  2. getParameters(String[] split)
  3. recursiveSplit(String str, String splitor)
  4. safeSplitParameters(String parameters)
  5. split(byte[] bytes, byte[] p)
  6. split(byte[] data)