Subversion Repositories SmartDukaan

Rev

Rev 34835 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34835 Rev 34859
Line 5... Line 5...
5
import com.spice.profitmandi.common.enumuration.DateTimePattern;
5
import com.spice.profitmandi.common.enumuration.DateTimePattern;
6
import org.apache.logging.log4j.LogManager;
6
import org.apache.logging.log4j.LogManager;
7
import org.apache.logging.log4j.Logger;
7
import org.apache.logging.log4j.Logger;
8
 
8
 
9
import javax.mail.internet.InternetAddress;
9
import javax.mail.internet.InternetAddress;
-
 
10
import java.text.Normalizer;
10
import java.time.*;
11
import java.time.*;
11
import java.time.format.DateTimeFormatter;
12
import java.time.format.DateTimeFormatter;
12
import java.time.format.DateTimeParseException;
13
import java.time.format.DateTimeParseException;
13
import java.util.ArrayList;
14
import java.util.ArrayList;
14
import java.util.List;
15
import java.util.List;
-
 
16
import java.util.Locale;
15
import java.util.regex.Matcher;
17
import java.util.regex.Matcher;
16
import java.util.regex.Pattern;
18
import java.util.regex.Pattern;
17
 
19
 
18
public class StringUtils {
20
public class StringUtils {
19
	
21
	
Line 279... Line 281...
279
		} else {
281
		} else {
280
			return String.format("%.2f", distanceInMeters / 1000.0);
282
			return String.format("%.2f", distanceInMeters / 1000.0);
281
		}
283
		}
282
	}
284
	}
283
 
285
 
-
 
286
	public static String toSlug(String input) {
-
 
287
		if (input == null) return "";
-
 
288
		String normalized = Normalizer.normalize(input, Normalizer.Form.NFD).replaceAll("\\p{M}", "");
-
 
289
		String lowerCase = normalized.toLowerCase(Locale.ENGLISH);
-
 
290
		String slug = lowerCase.replaceAll("[^a-z0-9]+", "-");
-
 
291
		slug = slug.replaceAll("^-+|-+$", "");
-
 
292
		return slug;
-
 
293
	}
-
 
294
 
284
}
295
}