473,836 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

character "grouping" in sort order

In a sorted list, certain characters are grouped together, for example "Áb"
(cedille b) comes after "ca" but before "cc".

Is there a built-in way to find out what 'base character', such as C for
cedille, a character belongs to for a given globalization setting?

Nov 20 '05 #1
6 1811
Hi

SortedList are sorted by the keys. Also the keys will be sorted by the
coding value of the key character.

Imports System
Imports System.Collecti ons

Module Module1
Sub Main()
' Creates and initializes a new SortedList.
Dim mySL As New System.Collecti ons.SortedList
mySL.Add("ca", "Hello")
mySL.Add("cedil le b", "World")
mySL.Add("cc", "!")
For i As Integer = 0 To mySL.Count - 1
Dim str As String = mySL.GetKey(i)
Dim size As Integer =
System.Text.Enc oding.Unicode.G etByteCount(str )
Dim buffs(size - 1) As Byte
buffs = System.Text.Enc oding.Unicode.G etBytes(str)
For j As Integer = 0 To size - 1
Console.Write("[{0:X}]", buffs(j))
Next
Console.WriteLi ne()
Console.WriteLi ne(mySL.GetKey( i) + ": " & mySL.GetByIndex (i))
Next
End Sub
End Module

So I think you may try to print out the keys' coding value to see if there
are any clue.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2
On Tue, 03 Aug 2004 05:41:22 GMT, v-******@online.m icrosoft.com ("Peter
Huang") wrote:
Hi

SortedList are sorted by the keys. Also the keys will be sorted by the
coding value of the key character.


Sorry, I should have been more clear, my problem isn't really related to
sorting.

What I'm doing is filling a treeview with a list of names.

The tree has two levels of nodes: the first level contains the letters of
the alphabet, the second contains all names starting with the same letter.
The problem is finding out what first-level node "special" names have to be
placed in, like "«akti" (C) and "÷nder" (O).

In a sorted list they appear at the right place (as if E and … are the same
letter), that's why I referred to it.
So the question is really simple: does a function exist that you can call
to get the "base character" for a certain character, as in

x = MysteriousFunct ion("…")

which would return "E" in this example.
I might be able to to roll my own, based on System.Globaliz ation.SortKey,
if I knew what the byte values in the KeyData property mean, but that seems
to be undocumented.

It looks like two characters belong to the same base character if the first
two bytes of their sortkeys are the same, so in the worst case I could scan
the alphabet for that condition, if I was certain that there are no
exceptions.

Nov 20 '05 #3
Hi Lucvdv,

Thank you for your input,
Now I am research the issue, and I will update you with new information
ASAP.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
Hi Lucvdv,

I think so far we do not have such function to do the job. You may try to
build a hashtable to map the special "O" to "O" in your own. So that
everytime you just need to strip off the head letter from the string and
then get their counterpart from the hashtable.

Hope this helps.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #5
On Thu, 05 Aug 2004 02:09:45 GMT, v-******@online.m icrosoft.com ("Peter
Huang") wrote:
Hi Lucvdv,

I think so far we do not have such function to do the job. You may try to
build a hashtable to map the special "O" to "O" in your own. So that
everytime you just need to strip off the head letter from the string and
then get their counterpart from the hashtable.

Hope this helps.


Thanks.
Just in case someone else is interested, this solution I created yesterday
seems to do the job too (it returns the index of the first-level node the
name goes in, 1-26 for A-Z or 0 for non-alphabetic symbols, using
SortInfo):

Private Function NameRootIndex(B yVal Name As String) As Integer
Static Initialized As Boolean
Static LookupTable(26) As Byte

Dim ch As Char = Name.Substring( 0, 1).ToUpper
Dim i As Integer = InStr("ABCDEFGH IJKLMNOPQRSTUVW XYZ", ch)

If i > 0 Then
Return i
Else
Dim k As Byte
Dim ci As System.Globaliz ation.CompareIn fo _
= Application.Cur rentCulture.Com pareInfo
If Not Initialized Then
For i = 1 To 26
LookupTable(i) = ci.GetSortKey(C hr(64 + i)).KeyData(1)
Next
Initialized = True
End If
With ci.GetSortKey(c h)
If .KeyData(0) <> 14 Then Return 0
k = .KeyData(1)
End With
For i = 1 To 26
If k = LookupTable(i) Then Return i
Next
End If
Return 0
End Function

Nov 20 '05 #6
Hi Lucvdv,

Thank you for you sharing in the community this will help many others.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1987
by: Rabe | last post by:
Hi all, here a little brain-twister (starting to spoil my weekend if I do not find a solution ... ;-) ) What I want to do is to find a XML-Schema expression that builds a grammar for the following XML document (fragment): <grouping_document> <app_list>
3
2747
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have reports at the plan (overall totals), department and division levels which have sorting and grouping implemented with this new
8
5070
by: Matt | last post by:
Hi all, Thank you for taking the time. I have a database with 45 tables on it. 44 tables are linked to a main table through a one to one relationship. My question is, is there no way i can have a query that will pull a single field from all the tables. In other words i should have 44 fields. when i try to do that same, i get an error message saying "Query is too complex"
49
14571
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On http://www.webreference.com/programming/javascript/gr/column9/ they say: <snip> The undefined property A relatively recent addition to JavaScript is the undefined property.
1
1688
by: ASF | last post by:
Is it possible to create a crystal report graph in which a user selects some parameters---a date range for instance--- AND the table field that they wish to "Group By" then hits the submit button and CR displays the graph on the webpage *Grouped By* the user's selection? In SQL terms, I'm trying to place a parameter in the Group By section of a select statement. Only problem is that CR in VS 2005 seems to want to establish the Grouping...
1
1734
by: Thomas Qi | last post by:
There is a basic sql below: SELECT CTEnr AS ID, TimeStamp, DatagramSize, Source AS LocalIP, Destination AS RemoteIP, Protocol, Messages, SourcePort AS LocalPort, DestPort AS RemotePort FROM SelectedRecs I want to get results by grouping by the field LocalPort and RemotePort, I try it like this: SELECT CTEnr AS ID, TimeStamp, DatagramSize, Source AS LocalIP,
35
2079
by: josh | last post by:
Hi, I coded the following but It does not return what I expect, why? #include <iostream> using namespace std; class Other { public: int i;
4
4109
by: jonceramic | last post by:
Hi guys, I have a user who wants to have a report that shows only the 10th value recorded by his equipment. (i.e. His equipment records temperature every 30 seconds, but he only wants to view the data at every 5 minutes.) I proposed using the "mod" function in a WHERE statement on the seconds "datepart" to test if each datapoint is an interval of 5 minutes from the starting number.
3
3700
BeemerBiker
by: BeemerBiker | last post by:
I tried the following that didnt work "c:\\new.mdb" 'c:\\new.mdb' "c:\\new\.mdb" So far, the only thing that worked is "c:\\new" but I had to rename the destination access database to get rid of the .mdb Here is a sql command that works just fine when giving it to the access wizard to execute as a query. It copies 3 columns from one database to another. INSERT INTO AvailableCourses ( , Grouping, )
0
9671
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10854
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10558
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10600
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectóplanning, coding, testing, and deploymentówithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4459
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.