473,796 Members | 2,729 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 1809
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
1985
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
2744
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
5068
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
14531
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
1685
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
1729
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
2075
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
4105
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
3699
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
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
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
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
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...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6800
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
5453
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...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.