473,395 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

list to search two ways

Hi,

I need to create a list a litle bit like this:

1 = q
2 = t
3 = z
4 = u
.....

But I need to have it in such a way that I can find easily the letter for a
given number, but also find easily the number for a given letter.

Is there a structure liek this in VB.NET? Or should I make it myself with a
DataView and a filter?

Thanks,

Pieter
Nov 21 '05 #1
3 971
Hi Pieter,

Well, there might be classes that are better suitable, but you could
easily do that using a char array. You would need a simple search to
obtain the number for a given character though.

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 21 '05 #2
The problem is too trivial to make much sense.

What are you not telling us?

(note: for an indexed search, you can use a simple lookup array to mirror
the character array, in inverse.
For example, if MyArray(MyIndex) == MyChar

then you would have another array

int MyNewIndex = (int) MyChar;
MyMirrorArray(MyNewIndex) == MyIndex

Does this make sense to you?
--- Nick

"DraguVaso" <pi**********@hotmail.com> wrote in message
news:eR*************@tk2msftngp13.phx.gbl...
Hi,

I need to create a list a litle bit like this:

1 = q
2 = t
3 = z
4 = u
....

But I need to have it in such a way that I can find easily the letter for a given number, but also find easily the number for a given letter.

Is there a structure liek this in VB.NET? Or should I make it myself with a DataView and a filter?

Thanks,

Pieter

Nov 21 '05 #3
Thanks both for the answers.
Although I found a solution like this:

I used the SortedList:

With the SortedList.ContainsKey(number) and the SortedList.Item(number) I
could get the corresponding letter...
With the SortedList.containsValue(letter) and the
SortedList.GetKey(SortedList.IndexOfValue(letter)) I could get the number...

Pieter

"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message
news:9TK9d.227584$3l3.20284@attbi_s03...
The problem is too trivial to make much sense.

What are you not telling us?

(note: for an indexed search, you can use a simple lookup array to mirror
the character array, in inverse.
For example, if MyArray(MyIndex) == MyChar

then you would have another array

int MyNewIndex = (int) MyChar;
MyMirrorArray(MyNewIndex) == MyIndex

Does this make sense to you?
--- Nick

"DraguVaso" <pi**********@hotmail.com> wrote in message
news:eR*************@tk2msftngp13.phx.gbl...
Hi,

I need to create a list a litle bit like this:

1 = q
2 = t
3 = z
4 = u
....

But I need to have it in such a way that I can find easily the letter
for a
given number, but also find easily the number for a given letter.

Is there a structure liek this in VB.NET? Or should I make it myself
with a
DataView and a filter?

Thanks,

Pieter


Nov 21 '05 #4

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

Similar topics

5
by: Darryl B | last post by:
I can not get anywhere on this project I'm tryin to do. I'm not expecting any major help with this but any would be appreciated. The assignment is attached. The problem I'm having is trying to set...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
2
by: George | last post by:
Using VS.NET 2002\Web Form\VB I have a dropdown list that will contain letters of the alphabet. At startup, it has only the letter A in the list. I add letters to the items list, as needed....
8
by: Rajesh | last post by:
Question :An element in a sorted list can be found in O(log n) time via binary search. But suppose I rotate the sorted list at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might...
1
by: rajesh_krec | last post by:
Question :An element in a sorted list can be found in O(log n) time via binary search. But suppose I rotate the sorted list at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5...
10
by: free2cric | last post by:
Hi, I have a single link list which is sorted. structure of which is like typedef struct mylist { int num; struct mylist *next;
4
by: bruce | last post by:
hi... i'm playing with a test sample. i have somethhing like: dog = mysql_get(.....)
6
by: Henrik Goldman | last post by:
Hello, I have a dataset which consist of a string username and string hostname as a key and then an integer representing a count as the matching "second" value in a pair. So far I've used...
8
by: Mike Copeland | last post by:
I am trying to learn/use the STL <listto implement a small application. I didn't get very far before I got a compile error that befuddles me. Here's the code: struct GENCHECK ...
10
by: yfredmann | last post by:
Hi dear friends, This problem might be so popular to some of you, but I couldn't be able to do it myself. The problem: How to delete a node from a single linked list using only one pointer? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.