v2.0.0
slugify
將字串轉換為 slug。適用於 URL、檔名、ID 等。
50喜歡 7萬近 30 天下載135Pub 分數
AndroidiOSWebmacOSWindowsLinux
將字串轉換為網址友好的簡碼,適用於 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 |