1. Improved the slugify logic.
This commit is contained in:
parent
e1a09ae033
commit
25137bab55
1 changed files with 6 additions and 4 deletions
|
@ -69,10 +69,12 @@ public class UtilityFunctions {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String slugify(String textToBeSlugified) {
|
public static String slugify(String textToBeSlugified) {
|
||||||
return StringUtils.substring(textToBeSlugified.toLowerCase()
|
String textBlockSeparator = "-";
|
||||||
.replaceAll("[^a-zA-Z0-9-]+", "-"),
|
return StringUtils.removeEnd(StringUtils.substring(textToBeSlugified.toLowerCase().trim()
|
||||||
0,
|
.replaceAll("[^a-zA-Z0-9-]+", textBlockSeparator),
|
||||||
VisConstants.MAX_NAME_TEXT_LENGTH);
|
0,
|
||||||
|
VisConstants.MAX_NAME_TEXT_LENGTH),
|
||||||
|
textBlockSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue