Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Small utility library for generating speaking URLs.

License

NotificationsYou must be signed in to change notification settings

slugify/slugify

Repository files navigation

GitHub licensejavadoc

Description

Small utility library for generating speaking URLs.

Usage Examples

Slugify is published in the Maven Central Repository:Click here

Basic

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

Underscore Separator

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

Case Sensitive

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

Specifying a Locale

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

Custom Replacements

finalSlugifyslg =Slugify.builder()// provided as a map    .customReplacements(Map.of("Foo","Hello","bar","world"))// provided as single key-value    .customReplacement("Foo","Hello")    .customReplacement("bar","world")    .build();finalStringresult =slg.slugify("Foo, bar!");// result: hello-world

Transliteration

Requirements

Gradle 6+

For Gradle 6+ users 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 sectionModeling feature variants and optional dependencies of gradle's user guide.

Other

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

Usage Example

finalSlugifyslg =Slugify.builder().transliterator(true).build();finalStringresult =slg.slugify("Б");// result: b

About

Small utility library for generating speaking URLs.

Topics

Resources

License

Stars

Watchers

Forks

Contributors5

Languages


[8]ページ先頭

©2009-2025 Movatter.jp