🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

com.github.slugify:slugify-parent

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.slugify:slugify-parent

SEO-friendly URLs with Slugify

Source
mavenMaven Central
Metadata Only
Version
2.5
Version published
Maintainers
1
Source

Slugify

GitHub license Check javadoc

Description

Small utility library for generating speaking URLs.

Usage Examples

Slugify is published in the Maven Central Repository: Click here

Basic

final Slugify slg = Slugify.builder().build();
final String result = slg.slugify("Hello, world!");
// result: hello-world

Underscore Separator

final Slugify slg = Slugify.builder().underscoreSeparator(true).build();
final String result = slg.slugify("Hello, world!");
// result: hello_world

Case Sensitive

final Slugify slg = Slugify.builder().lowerCase(false).build();
final String result = slg.slugify("Hello, world!");
// result: Hello-world

Specifying a Locale

final Slugify slg = Slugify.builder().locale(Locale.GERMAN).build();
final String result = slg.slugify("ä");
// result: ae

Custom Replacements

// provided as single key-value pairs
final Slugify slg = Slugify.builder()
    .customReplacement("Foo", "Hello")
    .customReplacement("bar", "world")
    .build();

// alternatively provided as a map
final Slugify slg = Slugify.builder()
    .customReplacements(Map.of("Foo", "Hello", "bar", "world"))
    .build();

final String result = slg.slugify("Foo, bar!");
// result: hello-world

Transliteration

Requirements

Gradle

There's a feature variant which can be used as follows:

capabilities {
    requireCapability('com.github.slugify:slugify-transliterator')
}

For more information about feature variants please check the section How to Create Feature Variants for a Library in Gradle.

Other

Manually add the optional dependency com.ibm.icu:icu4j to your project.

Usage Example

final Slugify slg = Slugify.builder().transliterator(true).build();
final String result = slg.slugify("Đ‘");
// result: b

FAQs

Package last updated on 06 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts