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

套件詳情v0.2.1

turkish

土耳其語大小寫轉換器及用於排序的比較器

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
447
喜歡數
53
Pub 分數
150

安裝套件

flutter pub add turkish

套件介紹

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

土耳其語套件提供專為土耳其語設計的字串大小寫轉換與比較工具,確保正確處理大小寫轉換,特別是 'I' 和 'ı' 等字元。支援在土耳其語環境中的正確排序與字串比較,解決標準函式庫可能忽略的地區特定規則。適用於需要精確處理土耳其語文字的應用程式,例如搜尋功能、資料排序以及跨多個平台的使用者輸入正規化。

適用情境

  • 土耳其文本排序
  • 基於區域設定的字串比較
  • 土耳其語中的大小寫轉換
  • 使用者介面文字處理
  • 土耳其內容的資料歸一化
  • 土耳其應用程式中的搜尋功能

主要特色

  • 正確處理土耳其語中的 'I' 和 'ı'
  • 特定區域的大小寫轉換
  • 內建排序工具
  • 跨平台相容性
  • 支援所有主要的Flutter平台
  • 透過 pub add 的簡單整合

適合對象

  • 面向土耳其用戶的應用
  • 具備土耳其語支援的國際化應用程式
  • 土耳其語文字處理工具
  • 需要本地化意識的排序算法
  • 需要在土耳其語中進行精確字串操作的開發人員

使用建議

  • 僅限土耳其語規則
  • 非土耳其語應用可能不需要
  • 需要理解土耳其語的語言細微差別
  • 不適用於一般用途的字串操作
  • 依賴於正確的區域設定配置
  • 非土耳其使用情境的額外開銷

原始 README

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

turkish

This library provides these functions for Turkish language for Dart:

  • Converting strings to lower, upper and title case.
  • Regular and ignore case string sorting.

Some casing operations for Turkish does not work correctly in Dart core libraries because Dart uses default unicode mappings. Default case mappings fails for Turkish i->İ and I->ı conversions.

This library may not be necessary for Flutter or web projects if they use underlying system methods for locale specific text operations. But it can be handy when that is not the case.

Current implementation does not handle two code-unit variations. Complete special casing rules are defined here.

Usage

Add this line to pubspec.yaml:

turkish: '>=0.2.1'

Add this line to the import section:

import 'package:turkish/turkish.dart'

Extension methods

There are four extension methods that can be used for comparison and upper, lower and title casing.

import 'package:turkish/turkish.dart';

// Uses extension methods.
main() {
  // upperCaseTr
  var inputL = "kısa şiir";
  print("UpperCase for [$inputL]");
  print("Default = ${inputL.toUpperCase()}, "
      "Turkish = ${inputL.toUpperCaseTr()}\n");

  // lowerCaseTr
  var inputU = "KISA ŞİİR";
  print("LowerCase for [$inputU]");
  print("Default = ${inputU.toLowerCase()}, "
      "Turkish = ${inputU.toLowerCaseTr()}\n");

  // compareToTr
  var zonguldak = "Zonguldak";
  var cankiri = "Çankırı";
  print("Comparison for [$zonguldak] and [$cankiri]");
  print("Default = ${zonguldak.compareTo(cankiri)}, "
      "Turkish = ${zonguldak.compareToTr(cankiri)}\n");
}
Output:
UpperCase for [kısa şiir]
Default = KISA ŞIIR, Turkish = KISA ŞİİR

LowerCase for [KISA ŞİİR]
Default = kisa şiir, Turkish = kısa şiir

Comparison for [Zonguldak] and [Çankırı]
Default = -1, Turkish = 1

'turkish' object.

Also, for turkish specific sorting and casing a single object instance exposed from library called turkish can be used.

See also related Pub page.

Example:

import 'package:turkish/turkish.dart';

main() {
  // upperCaseTr
  var inputL = "kısa şiir";
  print("UpperCase for [$inputL]");
  print("Default = ${inputL.toUpperCase()}, "
      "Turkish = ${turkish.toUpperCase(inputL)}\n");

  // lowerCaseTr
  var inputU = "KISA ŞİİR";
  print("LowerCase for [$inputU]");
  print("Default = ${inputU.toLowerCase()}, "
      "Turkish = ${turkish.toLowerCase(inputU)}\n");

  // compareToTr
  var zonguldak = "Zonguldak";
  var cankiri = "Çankırı";
  print("Comparison for [$zonguldak] and [$cankiri]");
  print("Default = ${zonguldak.compareTo(cankiri)}, "
      "Turkish = ${zonguldak.compareToTr(cankiri)}\n");

  // sort Default
  var list = ["Az", "ağ", "aç", "ad"];
  print("Input = $list");
  print("Default Sort = ${list..sort()}");

  // sort Turkish  
  list = ["Az", "ağ", "aç", "ad"];
  print("Turkish Sort = ${list..sort(turkish.comparator)}");

  // sort Turkish ignore case  
  list = ["Az", "ağ", "aç", "ad"];
  print("Turkish Sort Ignore Case = "
      "${list..sort(turkish.comparatorIgnoreCase)}");
}
Output:
UpperCase for [kısa şiir]
Default = KISA ŞIIR, Turkish = KISA ŞİİR

LowerCase for [KISA ŞİİR]
Default = kisa şiir, Turkish = kısa şiir

Comparison for [Zonguldak] and [Çankırı]
Default = -1, Turkish = 1

Input = [Az, ağ, aç, ad]
Default Sort = [Az, ad, aç, ağ]
Turkish Sort = [Az, aç, ad, ağ]
Turkish Sort Ignore Case = [aç, ad, ağ, Az]

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。