sustring test puzzle

This is a discussion on sustring test puzzle within the C# Programming forums, part of the General Programming Boards category; I have the following string: \?\hid#vid_04d8pid_003f#62edf110800000#{4d1e55b2-f16f-11cf-88cb-001111000030 stored in a string variable (from a function call) called devPathName and the following ...

  1. #1
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    sustring test puzzle

    I have the following string: \\?\hid#vid_04d8pid_003f#62edf110800000#{4d1e55b2-f16f-11cf-88cb-001111000030 stored in a string variable (from a function call) called devPathName

    and the following defined:
    Code:
    const string myDevice = @"vid_04d8pid_003f";
    but the following:
    Code:
     Boolean test;                
    test = devPathName.Contains(myDevice);
    statusLabel.Text += "\n\tThe value of test: " + test.ToString();
    always evaluates to false.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Print both string so you're 100% certain they contain what you think they contain.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Quote Originally Posted by Magos View Post
    Print both string so you're 100% certain they contain what you think they contain.
    I did.. No change
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  4. #4
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Attempting to extract a path from the string (using Path.GetFullPath) causes and exception which says the string contains the illegal characters '\r' and '\n'. Is there a way to remove these escape sequences from the string?
    I've already tried to replace 'em using the string.replace() method.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Integer Emulation
    By Elysia in forum C++ Programming
    Replies: 31
    Last Post: 03-18-2008, 02:03 PM
  2. undefined reference
    By 3saul in forum Linux Programming
    Replies: 12
    Last Post: 08-23-2006, 06:28 PM
  3. Crossword Puzzle Program
    By Loctan in forum C++ Programming
    Replies: 2
    Last Post: 08-01-2006, 12:08 AM
  4. C++ Operator Overloading help
    By Bartosz in forum C++ Programming
    Replies: 2
    Last Post: 08-17-2005, 01:55 PM
  5. MSVC Template Constructor/Assignment Errors
    By LuckY in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 03:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21