Java tutorial
//package com.java2s; import java.util.*; import java.util.regex.*; public class Main { static final Matcher fpMatch = Pattern .compile("([-+]?((\\d*\\.\\d+)|(\\d+))([eE][+-]?\\d+)?)(\\%|in|cm|mm|pt|pc|px|em|ex)?").matcher(""); public synchronized static float[] parseFloatList(String list) { if (list == null) return null; fpMatch.reset(list); LinkedList<Float> floatList = new LinkedList<Float>(); while (fpMatch.find()) { String val = fpMatch.group(1); floatList.add(Float.valueOf(val)); } float[] retArr = new float[floatList.size()]; Iterator<Float> it = floatList.iterator(); int idx = 0; while (it.hasNext()) { retArr[idx++] = ((Float) it.next()).floatValue(); } return retArr; } }