C
ckirchho
Hello,
I would like to use an array as a search index. The code defining the
array is not generated with JavaScript.
When searching a word in the index, I do a quick binary search. Which
fails, of course, if the order of the words in the array is not in
exactly the way as JavaScript would sort them.
The words in the index can contain special characters, e.g. from the
german, french or spanish alphabet.
I wonder what might be easier: To teach the external application to
sort the index array in a way that equals the JavaScript sorting, OR
to teach JavaScript to compare strings in a way that the binary search
works correctly.
By the way: Which is the JavaScript way of sorting? It seems that all
standard capital letters come in front of lower case letters, and all
non standard letters come at the end. e.g. ABC...XYZabc...xyzÄÉÖÜßäéöü
Right now I load the array an let JavaScript sort it, which of course
consumes time.
Would be great if anybody could name some sources of information, or
give me some techniques.
Best regards,
Christian Kirchhoff
I would like to use an array as a search index. The code defining the
array is not generated with JavaScript.
When searching a word in the index, I do a quick binary search. Which
fails, of course, if the order of the words in the array is not in
exactly the way as JavaScript would sort them.
The words in the index can contain special characters, e.g. from the
german, french or spanish alphabet.
I wonder what might be easier: To teach the external application to
sort the index array in a way that equals the JavaScript sorting, OR
to teach JavaScript to compare strings in a way that the binary search
works correctly.
By the way: Which is the JavaScript way of sorting? It seems that all
standard capital letters come in front of lower case letters, and all
non standard letters come at the end. e.g. ABC...XYZabc...xyzÄÉÖÜßäéöü
Right now I load the array an let JavaScript sort it, which of course
consumes time.
Would be great if anybody could name some sources of information, or
give me some techniques.
Best regards,
Christian Kirchhoff