パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細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]

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。