Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't get VFP's ASC() equivalent
Message
From
25/06/2002 14:44:00
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00672119
Message ID:
00672131
Views:
14
John,

There's more than one way to skin a cat ... even in C#.

In addition to the suggestions already given, you could also do this:
int i = (int)cString.ToCharArray(0,1)[0];
Also, note ... I think you mean (0,1) rather than (1,1) ... remember, zero-based arrays.

~~Bonnie



>In VFP I can do this:
>
>lnChar = asc( substring( cString, 1, 1 ) )
>
>
>I can't figure out how to do it in c#. I've tried
>
>int lnChar = (int)cString.Substring( 1, 1 )
>
>but I get an error 'Cannot convert type string to int'. Apparently, it must be type 'char' in order to cast it as an 'int'. The only problem is, 'Cannot convert type string to char' either. Anybody know what I need to do here? Thanks a lot,
>jfh
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform