v2.0.0
slugify
将字符串转换为 URL 友好的短链接。适用于 URL、文件名、ID 等。
50喜欢 7万近 30 天下载135Pub 分数
AndroidiOSWebmacOSWindowsLinux
将字符串转换为 URL 友好的短语,适用于 URL、文件名、ID 等
^1.16.4^1.0.0以下为英文项目原文快照,最新内容请访问 GitHub。
Converts any String to a slug. Useful for URLs, filenames, IDs, and more.
import 'package:slugify/slugify.dart';
// Use with default options.
var slug = slugify('Hello, World! Foo Bar');
print(slug); // hello-world-foo-bar
// Use with custom options.
var slug2 = slugify('Hello, World! Foo Bar', lowercase: false, delimiter: '🙂');
print(slug2) // Hello🙂World🙂Foo🙂Bar
| Name | Type | Default | Description |
|---|---|---|---|
delimiter |
String |
"-" |
Separator between words |
lowercase |
bool |
true |
Convert text to lowercase |