Changeset 6538 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2013-12-26T15:19:31+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6524 r6538 38 38 import java.util.Iterator; 39 39 import java.util.List; 40 import java.util.regex.Matcher; 40 41 import java.util.zip.GZIPInputStream; 41 42 import java.util.zip.ZipFile; … … 835 836 return String.format("%d %s %d %s", days, trn("day", "days", days), elapsedTime/3600000, tr("h")); 836 837 } 838 839 /** 840 * Returns a list of capture groups if {@link Matcher#matches()}, or {@code null}. 841 * The first element (index 0) is the complete match. 842 * Further elements correspond to the parts in parentheses of the regular expression. 843 * @param m the matcher 844 * @return a list of capture groups if {@link Matcher#matches()}, or {@code null}. 845 */ 846 public static List<String> getMatches(final Matcher m) { 847 if (m.matches()) { 848 List<String> result = new ArrayList<String>(m.groupCount() + 1); 849 for (int i = 0; i <= m.groupCount(); i++) { 850 result.add(m.group(i)); 851 } 852 return result; 853 } else { 854 return null; 855 } 856 } 837 857 }
Note:
See TracChangeset
for help on using the changeset viewer.