turkish-string
isomorphic turkish string utilities for javascript
Installation
$ yarn add turkish-string
Documentation
initialize via constructor, create or clone methods
const TurkishString = ; const str1 = "string";const str2 = TurkishString;const str3 = str1;const str4 = TurkishString;const str5 = str4;
Lowercase transform
const TurkishString = ; const instance = "Ç-Ğ-I-İ-Ö-Ş-Ü";const str1 = instance; //ç-ğ-ı-i-ö-ş-üconst str2 = TurkishString; //ç-ğ-ı-i-ö-ş-üconst str3 = TurkishString; //ç-ğ-ı-i-ö-ş-ü
Uppercase transform
const TurkishString = ; const instance = "ç-ğ-ı-i-ö-ş-ü";const str1 = instance; //Ç-Ğ-I-İ-Ö-Ş-Üconst str2 = TurkishString; //Ç-Ğ-I-İ-Ö-Ş-Üconst str3 = TurkishString; //Ç-Ğ-I-İ-Ö-Ş-Ü
Clear turkish characters
const TurkishString = ; const instance = "Ç-Ğ-I-İ-Ö-Ş-Ü";const str1 = instanceclear; //C-G-I-I-O-S-Uconst str2 = TurkishStringclear"Ç-Ğ-I-İ-Ö-Ş-Ü"; //C-G-I-I-O-S-Uconst str3 = TurkishStringclearinstance; //C-G-I-I-O-S-U
Sorting support
For sorting TurkishString.compare
method can be use as compare function
const letters = "ğ" "g'" "f" "e" "d" "ç" "c" "b" "a"; const englishSorted = letters;//["a", "b", "c", "d", "e", "f", "g", "ç", "ğ"] const turkishSorted = letters;//["a", "b", "c", "ç", "d", "e", "f", "g", "ğ"]
Other instance and static methods
- isLessThan
- isLessThanOrEqual
- isGreaterThan
- isGreaterThanOrEqual