搜尋套件、儲存庫與 APP 分類

套件詳情v4.2.0

strings

大量字串函數,旨在擴展String類別,同時為處理可空字串提供更安全的方法。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
15.7萬
喜歡數
58
Pub 分數
160

安裝套件

flutter pub add strings

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

strings 套件提供了一組豐富的實用函數,擴展了 Dart String 類,為處理非空和可為空的字串提供了更安全且更方便的方法。該套件透過支援空值安全的操作來增強字串操作,降低執行時錯誤的風險。此套件旨在簡化常見的文字處理任務,例如修剪、分割、驗證和轉換字串,同時維持乾淨且易讀的程式碼。非常適合希望在多個平台改善字串處理的開發人員。

適用情境

  • 字串驗證
  • 空安全的字串操作
  • 文字格式化
  • 資料解析
  • 輸入淨化
  • 國際化支援

主要特色

  • 擴展 String 類別以新增額外方法
  • 空安全工具
  • 全面的字串操作
  • 跨平台相容性
  • 透過 pub 實現輕鬆整合
  • 文件完整的 API

適合對象

  • Web與行動應用程式開發
  • 表單輸入處理
  • API 數據處理
  • 文字轉換工作流程
  • 重視程式碼安全的開發者

使用建議

  • 需要理解空安全
  • 可能為簡單情況增加輕微開銷
  • 僅限字串專用工具
  • 不適用於複雜的正則表達式或模式匹配
  • 最適合已經使用空安全的專案

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

The Strings package is an evolution of the work originally produced by Andrew Mezoni.

The purpose of the Strings package is to provide:

  • a collection of useful String functions to complement the core String class.
  • where viable, directly extend the String class with methods such as String.right, String.left...
  • provide a safer environment when working with nullable Strings (String?)
  • wrappers for each of the core String methods which are safe to use with a nullable String?.

A core objective of the Strings package is to never 'throw' or return an error but to make a best effort to process the passed data.

// passing null works too.
Strings.right(null, 4, pad: Pad.left);
 -> '    '

// pass a short string and we can pad it (or not).
Strings.right('one', 4, pad: Pad.left);
 -> ' one'

The Strings package also includes a number of methods exposed as extensions to the core Dart String class:

'a normal string'.right(4);
-> 'a no'

See the full list

The Strings package incudes over 50 functions.

You can see the full list including examples at:

strings.onepub.dev

Contributing:

The strings package is hosted on github at: github.com/onepub-dev/strings

Contributions are welcomed.

Sponser

The strings package is sponsored by OnePub - the private Dart repository SaaS.

onepub.dev

OnePub Logo

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案