dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: c# substring utility

  1. #1
    Join Date
    Jan 2004
    Posts
    377

    c# substring utility

    Not sure if there is where I should be posting this information but here it goes (please direct me where to go if this is the wrong place)

    I have a variable that looks like this

    variable r00000000000000000000000000
    or r10101010101010101010101010

    and everytime a certain action is taken one of the 0's will change.
    I need to check this against a stored variable to see if only 1 was changed.

    in php i would do something like this
    for ($x=0; $x<27; $x++)
    if (!($variable{$x} == $storedvariable{$x}))
    $changes++;

    How do I do this in c#

    any help or suggestions would be greatly appreciated

  2. #2
    Join Date
    Nov 2004
    Location
    Utah
    Posts
    23
    for(int x=0;x<27;x++)
    {
    if (!(variable.Substring(x,1) == storedvariable.Substring(x,1) )
    changes++;
    }

    HTH

    Ben Miller

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles