473,387 Members | 1,431 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,387 software developers and data experts.

Character equivalent of elements in an Enumeration

I have an enumeration as follows

Public Enum Delimiters
Tab
Semicolon
Comma
Space
End Enum

How can I return character equivalent of the elements in the enumeration?

Should I write a Function which checks each element and return character
equivalent or is there any other way as well?

Thanks

Jul 21 '05 #1
2 2084
Job,

You use the enum while you are programming, what is the goal you want to
reach with this enum.

Cor
Jul 21 '05 #2
Job,
Normally when I need character constants I use character constants instead
of an Enum.

Something like:

Public Notinheritable Class Delimiters

Const Tab As Char = ControlChars.Tab
Const Semicolon As char = ";"c
Const Comma As Char = ","c
Const Space As Char = " "c

Private Sub New()
End Sub

End Class

The "Notinheritable" prevents any one from inheriting from this class, the
"Private Sub New" prevents any one from instantiating this class.

NOTE: I normally put the above in the class where they are needed, not in
their own class...

If I "really" needed/wanted an Enum, I would consider using the AscW code of
the characters then use ChrW to get Characters out. However! I would
seriously consider the above constants first!

Something like:

Public Enum Delimiters

Tab = AscW(ControlChars.Tab)
Semicolon = AscW(";"c)
Comma = AscW(","c)
Space = AscW(" "c)

End enum

Dim ch As Char = ChrW(Delimiters.Tab)
Hope this helps
Jay

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:3A**********************************@microsof t.com...
|I have an enumeration as follows
|
| Public Enum Delimiters
| Tab
| Semicolon
| Comma
| Space
| End Enum
|
| How can I return character equivalent of the elements in the enumeration?
|
| Should I write a Function which checks each element and return character
| equivalent or is there any other way as well?
|
| Thanks
|
Jul 21 '05 #3

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

Similar topics

0
by: C. M. Sperberg-McQueen | last post by:
wooks (wookiz@hotmail.com) wrote: > <?xml version='1.0'?> > <userlogin xmlns="urn:faster:userlogin" > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> > <login>mick</login> > ...
9
by: Stanimir Stamenkov | last post by:
Using Xerces2 Java I'm trying to validate a CSV data following an XNI example <http://xml.apache.org/xerces2-j/xni-config.html#examples>. The CSV scanner generates XML tree events like: <csv>...
7
by: Mark | last post by:
Hi... I've been doing a lot of work both creating and consuming web services, and I notice there seems to be a discontinuity between a number of the different cogs in the wheel centering around...
2
by: kamp | last post by:
Hello, Below is a snippet from a schema. The second enumeration should contain an i umlaut (archaïsch) but when I use this schema with Altova's Stylevision software the iumlaut is not displayed...
2
by: Job Lot | last post by:
I have an enumeration as follows Public Enum Delimiters Tab Semicolon Comma Space End Enum How can I return character equivalent of the elements in the enumeration?
6
by: Claude Henchoz | last post by:
Hi guys I have a huge list of URLs. These URLs all have ASCII codes for special characters, like "%20" for a space or "%21" for an exclamation mark. I've already googled quite some time, but I...
8
by: Mark P | last post by:
I'm working on a project where I have something like enum Modes {mode_a, mode_b, ...}; Due to project spec changes, the number of Modes has increased several times. There are a few places...
1
by: DrDavey | last post by:
What are the advantages/disadvantages of using a choice of a several "sub-"elements with empty content (and no attributes) vs. simple content. Here's an example: Using simple content:...
0
by: Bruno BARON | last post by:
Hi, When I expose a enum to COM, the name of the enumeration is automatically added in prefix to the names of the elements of the exposed enumeration. Sample: public enum EnumerationName {
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...

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.