Git Product home page Git Product logo

turkish's Introduction

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.

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.1.0'

Add this line to the import section:

import 'package:turkish/turkish'

There is a single object instance exposed from library called turkish. All operations are accessed through this object.

See also related Pub page.

Example:

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

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

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

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

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

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]

turkish's People

Contributors

ahmetaa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.