Peter Z <peter_zahos@pr imus.com.au> wrote:[color=blue]
> Does anyone know the equivalent VB Asc function for C#?
>
> Or ways around it?[/color]
Could you say *exactly* what you want to do? Note that the value of any
char is its unicode value - and if the character is an ASCII character,
that will be exactly the ASCII value.
If you want to know the value of any character in the system's default
code page, you should look at using Encoding.Defaul t.
NULL <Thomas-dot-Delrue-at-Tiscali-dot-Be> <NULL <Thomas-dot-Delrue-at-
Tiscali-dot-Be>> wrote:[color=blue][color=green]
> >Marvellous effort that![/color]
>
> What do you mean?
>
> It is simple as 1-2-4 (sorry, 1-2-3 :) )
> just like in C, C++ (etc.) a char is a datatype of 1 byte[/color]
On Tue, 2 Sep 2003 13:55:47 +0100, Jon Skeet <skeet@pobox.co m> wrote:
[color=blue]
>NULL <Thomas-dot-Delrue-at-Tiscali-dot-Be> <NULL <Thomas-dot-Delrue-at-
>Tiscali-dot-Be>> wrote:[color=green][color=darkred]
>> >Marvellous effort that![/color]
>>
>> What do you mean?
>>
>> It is simple as 1-2-4 (sorry, 1-2-3 :) )
>> just like in C, C++ (etc.) a char is a datatype of 1 byte[/color]
>
>Um, no. char is a datatype of *2* bytes...[/color]
Unicode? Ah... didn't know that...
anyway, the conversion still works :)
On Tue, 2 Sep 2003 13:55:47 +0100, Jon Skeet <skeet@pobox.co m> wrote:
[color=blue]
>NULL <Thomas-dot-Delrue-at-Tiscali-dot-Be> <NULL <Thomas-dot-Delrue-at-
>Tiscali-dot-Be>> wrote:[color=green][color=darkred]
>> >Marvellous effort that![/color]
>>
>> What do you mean?
>>
>> It is simple as 1-2-4 (sorry, 1-2-3 :) )
>> just like in C, C++ (etc.) a char is a datatype of 1 byte[/color]
>
>Um, no. char is a datatype of *2* bytes...[/color]
Jon Skeet said:[color=blue][color=green]
>>Note that the value of any char is its unicode value[/color][/color]
On Wed, 3 Sep 2003 07:11:21 +0800, "Pete Z" <peter@infovisi on.com.aj>
wrote:
[color=blue]
>It's a way of saying thankyou![/color]
:D
np (sorry, a bit too much hours wihtout sleep I guess. :S sorry)
[color=blue]
>
>
>"NULL" <Thomas-dot-Delrue-at-Tiscali-dot-Be> wrote in message
>news:nlv8lv4uh jm8s8gaa7gaef21 j6bjb8gqnb@4ax. com...[color=green]
>> On Tue, 2 Sep 2003 19:22:16 +0800, "Peter Z"
>> <peter_zahos@pr imus.com.au> wrote:
>>[color=darkred]
>> >Marvellous effort that![/color]
>>
>> What do you mean?
>>
>> It is simple as 1-2-4 (sorry, 1-2-3 :) )
>> just like in C, C++ (etc.) a char is a datatype of 1 byte, that can be
>> converted to any other (native) datatype that is larger (int, short,
>> long, byte, etc...) by just casting it...
>> You can also try this:
>>
>> int nASCII = Convert.ToInt32 ('A');
>> long lASCII = Convert.ToInt64 ('B');
>> short sASCII = Convert.ToInt16 ('C'); //short==16 bits? (I though so)
>>
>> --
>> NULL
>>[color=darkred]
>> >"NULL" <Thomas-dot-Delrue-at-Tiscali-dot-Be> wrote in message
>> >news:s1u8lvckj 8l7cg6lcb60edvb ki63sbsqja@4ax. com...
>> >> On Tue, 2 Sep 2003 18:48:39 +0800, "Peter Z"
>> >> <peter_zahos@pr imus.com.au> wrote:
>> >>
>> >> >Hello folks,
>> >> >
>> >> >Does anyone know the equivalent VB Asc function for C#?
>> >> >
>> >> >Or ways around it?
>> >>
>> >> try this
>> >>
>> >> int nASCII = (int)'A'; //should give 65 or 91 or something like
>> >> //that...?
>> >> int nASCII2 = (int)myCharVari able;
>> >> int nASCII3 = (int)myString[1]; //second char in string[/color]
>>[/color]
>[/color]
Comment