473,372 Members | 828 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,372 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 2083
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 {
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.