given, [data has nepali words which are read from a UTF8 file.]
$varToSort[0]="के छ kay chha";
$varToSort[1]="गयो gayo";
$varToSort[2]="खराया kharayo";
$varToSort[3]="कुमारी kumari";
$varToSort[4]="पड pada";
since the sort function won't be able to handle none ASCII characters, (can it ?) I thought I could pass the entire array/data through a loop and sort based on a pattern that's define in another array. So I have another array where the patterns are.
$NepaliSortPattern=Array (
"क ka",
"के kay",
"कु ku",
"की key",
"कै kai",
"ख kha",
"खे khay",
"खु khu",
"खै khai",
"ग ga",
"गु gu",
"गै gai",
"गी gee",
"गा ga"
)
Key of Array represents the order in which data needs to be sorted and the array is only a part of the Nepali Alphabets. Nepali language has over 36 alpha but each alpha can have many sub alpha that needs to be added so the sorting is proper. I will add all of them here so it might useful to others.
Required : A loop that compares first few characters of the $varToSort with Each NepaliSortPattern starting from the first array to the last. If Unicode Characters are too difficult to work with, we can compare the strings written in English after the Nepali.
How to create that beautiful loop, compare, and sort.... Please. I think it's not possible.
Any SMART dude out there ?
please help and i am gonna write your name in BEAUTIFULLY in Nepali.... Guys believe me. I couldn't find a solution to this on the web and I am sure many other languages could be sorted using this technique where the author will only need to define the sort pattern. Please help You Smart !