473,320 Members | 2,088 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,320 software developers and data experts.

How do I convert a single character, e.g. "a" into char

How do I convert a single character, e.g. "a" into char
for use in the 'split' command?

p.s.
I have option strict on

Tia.
Nov 21 '05 #1
6 1733
ctype("a", char)
<tt> wrote in message news:uT**************@TK2MSFTNGP12.phx.gbl...
How do I convert a single character, e.g. "a" into char
for use in the 'split' command?

p.s.
I have option strict on

Tia.

Nov 21 '05 #2
add a 'c' to denote character in your split call after your character to
split on, are you sure it's even needed though?

dim s as string = "oneatwoathreeafour"
dim values() as string = s.split("a"c)
dim morevalues() as string = s.split("a")
both produce the same results.

<tt> wrote in message news:uT**************@TK2MSFTNGP12.phx.gbl...
How do I convert a single character, e.g. "a" into char
for use in the 'split' command?

p.s.
I have option strict on

Tia.

Nov 21 '05 #3

"Jared" <as***********@nospam.com> wrote in message
news:10*************@corp.supernews.com...
add a 'c' to denote character in your split call after your character to
split on, are you sure it's even needed though?

dim s as string = "oneatwoathreeafour"
dim values() as string = s.split("a"c)
yes, this worked, I like this.
dim morevalues() as string = s.split("a")
this will not work with option strict
both produce the same results.

<tt> wrote in message news:uT**************@TK2MSFTNGP12.phx.gbl...
How do I convert a single character, e.g. "a" into char
for use in the 'split' command?

p.s.
I have option strict on

Tia.



Nov 21 '05 #4
Tia,
As Jared suggested use a small c, as in "a"c.

You can also use String.ToCharArray if you want to convert multiple
character string to an array of Chars.

Dim command As String
Dim delims As String = ",./"
Dim args() As String

args = command.Split(delims.ToCharArray())

Would be the same as:

args = command.Split(","c, "."c, "/"c)

However I would use the char literal ("a"c) for single characters, I've used
ToCharArray where I read the delimiters from an "external" source (such as a
parameter to the constructor, or a config file).

Hope this helps
Jay

<tt> wrote in message news:uT**************@TK2MSFTNGP12.phx.gbl...
How do I convert a single character, e.g. "a" into char
for use in the 'split' command?

p.s.
I have option strict on

Tia.

Nov 21 '05 #5
Jay,

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> schrieb:
As Jared suggested use a small c, as in "a"c.


The 'c' doesn't necessarily be a lower case character:

<URL:http://msdn.microsoft.com/library/en-us/vblr7/html/vadatChar.asp>

:-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #6
Herfried,
That's true, however VS.NET changes it to a small c, so why fight it ;-)

Jay

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Jay,

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> schrieb:
As Jared suggested use a small c, as in "a"c.


The 'c' doesn't necessarily be a lower case character:

<URL:http://msdn.microsoft.com/library/en-us/vblr7/html/vadatChar.asp>

:-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #7

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

Similar topics

5
by: Brad Moore | last post by:
Hey all, I'm getting the following compiler error from my code. I was wondering if anyone could help me understand the concept behind it (I actually did try and compile this degenerate...
7
by: MilanB | last post by:
Hello How to convert char to int? Thanks
2
by: Alper Akcayoz | last post by:
Hello Esteemed Developpers I would like to thank you in advance for your sincere responses I am a fresh Visual C++ .NET Developer. Can you kindly guide me for How to Convert char* to System::String
2
by: Joah Senegal | last post by:
Hello I need to convert a chat to a string... but I don't know how to do this. i;ve searched the internet but I've only find some code to convert char * to string or char to string.... but I...
3
by: simon | last post by:
I am a fresh Visual C++ .NET Developer. Can you kindly guide me for How to Convert char to System::String I am using windows forms and trying to set a text value referencing the method...
5
by: Zytan | last post by:
I am surprised that a single character string is not auto-created from a single char. It is hard to find information on converting a char into a string, since most people ask how to convert char...
6
by: arti | last post by:
I dont want to use Convert(Char(9),date,106) function to show date in dd/MM/yyyy format. It changes the datatype of my column to char & I cant perform other date operations on it without changing it...
2
by: Rasheed | last post by:
Hi, i have a char pointer buffer which will hold the bitmap buffer, So i need to convert char *buffer as a bitmap. becuase when i draw on the Dialog using char *buffer. Nothing will be dispalyed....
1
by: helios | last post by:
Hi all, I'm resolved problem. and I want anybody need me that convert char to array bits char ConvertChar2ArrayBit(char ch) { char Bits; .... return Bits; } for...
3
by: mamul | last post by:
Hi please some one can help me. how to convert char * to string? i have take char *argv from command line and want to pass to a function as string object(string str) i want to first convert argv...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.