Re: illegal characters

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 02/04/05


Date: Fri, 4 Feb 2005 20:45:43 -0000

Dave <Dave@discussions.microsoft.com> wrote:
> I need to cut out illegal characters in a string submitted from a mobile
> phone to a web form. I need a way to check for the illegal characters in a
> textbox. I intend to loop through the text and remove the illegal characters.
> Is there an equivalent function to c# to chr() in Visual basic? I want the
> decimal value of a character, like "A" is 65 in ACII2. If there is a
> equilvalent command does it return ACII2 or unicode?
>
> I know there is a chr command in c# but it dosen't do the same thing.

There's no "chr" command (or any commands) in C#. However, you can just
use the unicode value:

int x = 'A'; // x will now be 65

-- 
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Relevant Pages

  • Re: Sending binary data with MSCOMM....
    ... I have an application that communicates with an industrial recirculating chiller via RS232. ... indicating that the received command was not valid. ... Dim iIndex As Integer, sCommandString As String ... 'CHR' function that would be different on the Chinese version of Windows? ...
    (microsoft.public.vb.general.discussion)
  • Re: Quick sqlplus cr/lf question
    ... Might be some 'set' command in the session which enables ... the use of 'chr' values or something, ...
    (comp.databases.oracle.server)
  • Re: Deleting files
    ... > How do I delete files that contain illegal characters? ... > ftproot and there are a slew of obscurely named directories that appear to ... Most can be deleted with a "wildcard" command from a Command ...
    (microsoft.public.win2000.general)
  • Re: Deleting files
    ... No luck. ... The names appear to use non-printing characters. ... >> How do I delete files that contain illegal characters? ... > Most can be deleted with a "wildcard" command from a Command ...
    (microsoft.public.win2000.general)
  • Using a chr character code higher than 255?
    ... I'm trying to use the replace command to pull out all the horizontal ellipsis ... characters [chr(8230), or '...'] from a string, but the chrcommand won't ...
    (microsoft.public.access.modulesdaovba)