Révision 2266
| tmp/org.txm.utils/src/org/txm/utils/AsciiUtils.java (revision 2266) | ||
|---|---|---|
| 115 | 115 |
* @param s the s |
| 116 | 116 |
* @return the string |
| 117 | 117 |
*/ |
| 118 |
public static String buildAttributeId(String s) |
|
| 119 |
{
|
|
| 118 |
public static String buildAttributeId(String s) {
|
|
| 120 | 119 |
|
| 121 | 120 |
//TODO: replace this with a lib managing the ID attribute format |
| 122 | 121 |
if (s.length() == 0) return s; |
| 123 | 122 |
|
| 124 | 123 |
String rez = convertNonAscii(s).toLowerCase(); |
| 125 |
rez = rez.replaceAll("\\p{Space}","");
|
|
| 124 |
rez = rez.replaceAll("\\p{Space}++","_");
|
|
| 126 | 125 |
rez = rez.replaceAll("[¤€§µ£°().,;:/?§%\"'*+\\-}\\]\\[{#~&]",""); //$NON-NLS-1$ //$NON-NLS-2$
|
| 127 | 126 |
// remove first chars if number |
| 128 | 127 |
char c = rez.charAt(0); |
Formats disponibles : Unified diff