
com.tailoredshapes.underbar.UnderReg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ocho Show documentation
Show all versions of ocho Show documentation
Foundational functions inspired by Clojure and underscore.js
package com.tailoredshapes.underbar;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by tmarsh on 11/2/16.
*/
public interface UnderReg {
static Pattern pattern(String s) {
return Pattern.compile(s);
}
static Matcher matcher(Pattern re, CharSequence s) {
return re.matcher(s);
}
static List groups(Matcher m) {
List l = new ArrayList<>();
if (!m.matches()) {
return l;
}
int groupCount = m.groupCount();
for (int c = 1; c <= groupCount; c++) {
String group = m.group(c);
l.add(group);
}
return l;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy