Re: Problem with string.indexofany

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


Date: Tue, 24 Aug 2004 14:40:30 +0100

Systemspecialist <Systemspecialist@discussions.microsoft.com> wrote:
> I have string where i have to find every character with ASCII code between 0
> and 31. I tried to do this:
> char[] xxx= new char[]
> {Convert.ToChar(00),Convert.ToChar(01),Convert.ToChar(02),Convert.ToC
> har(03),Convert.ToChar(04),Convert.ToChar(05),Convert.ToChar(06),Conve
> rt.ToChar(07),Convert.ToChar(08),Convert.ToChar(09),Convert.ToChar(10)
> ,Convert.ToChar(11),Convert.ToChar(12),Convert.ToChar(13),Convert.ToCh
> ar(14),Convert.ToChar(015),Convert.ToChar(16),Convert.ToChar(17),Conve
> rt.ToChar(18),Convert.ToChar(19),Convert.ToChar(20),Convert.ToChar(21)
> ,Convert.ToChar(22),Convert.ToChar(23),Convert.ToChar(24),Convert.ToC
> har(25),Convert.ToChar(26),Convert.ToChar(27),Convert.T
> oChar(28),Convert.ToChar(29),Convert.ToChar(30),Convert.ToChar(31)};
> text.IndexOfAny(xxx));
>
> but it doesn't work. If i try do this:
>
> char[] xxx= new char[] {'?'}; //? its character for ASCII code 13 (enter)
> this works, but i cannot print ascii code < 10 . Can anybody help me??

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

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


Relevant Pages

  • Need help to remove tbas, carriage retrun, and other!!!
    ... ASCII code of the character ... that I link to) to specify the string that you want to ... optionally the ascii chr number of the delimiter ... 'At the start point of the string (1 character after the ...
    (microsoft.public.access.queries)
  • Re: Character representation
    ... >> Also is there any character to ASCII code and ASCII code to character ... we use vbKeyTab for Tab and vbCrLf for line feed in VB) ... > However, you'll probably want them as string (and for vbCrLf, it would ...
    (microsoft.public.dotnet.languages.csharp)
  • End of String Character?
    ... string using some extended ASCII characters (ASCII code> 128) ... I am wondering if there is a reserved character in VB that signifies ... the end of a string of characters. ... Is my encryption algorithm possible generating a reserved character ...
    (microsoft.public.scripting.vbscript)
  • Re: String manipulation
    ... | I'm writing a program that requires some string manipulations. ... the ascii code for 'x' is 0x78. ... and print the character corresponding to the ...
    (comp.lang.python)
  • Re: Text format
    ... the question was if the lower case letters are ALWAYS ... That is the following string is not in ... character 10 who have the ascii code>=97. ...
    (microsoft.public.excel.misc)