public static String recupererInfo(String nomFichier){ String res=""; String patternStr = "([^0-9]*)\\p{Space}[0-9].*"; Pattern pattern = Pattern.compile(patternStr); Matcher matcher = pattern.matcher(nomFichier); boolean matchFound = matcher.find(); if (matchFound && matcher.groupCount()>=1) { res = matcher.group(1); } return res; } public static void main(String[] args) { String test="OFFRE DEF 08 AOUT 2011.xls "; System.out.println(recupererInfo(test)); }
StringTokenizer st = new StringTokenizer(" OFFRE 28 AOUT 2011.xls", " "); System.out.println(st.nextToken());
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question