Char bit shift

Results 1 to 2 of 2

Thread: Char bit shift

  1. #1
    Join Date
    Dec 1969

    Default Char bit shift

    HELP!! It&#039;s been too long since I&#039;ve done any asp, I&#039;ve been busy on a C# port, but out of the blue, a special request has come through.<BR><BR>I need to take a string, split it into an array of characters, bit shift each character one bit left then put it back into string format! <BR><BR>How in the world do you do this in ASP?<BR><BR>Thanks in advance, Kev<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Left shift 1 same as doubling

    SO just multiply by 2.<BR><BR>&#060;%<BR>str = "This is a demo"<BR>shifted = ""<BR>For i = 1 To Len(str)<BR> shifted = shifted & ChrW( 2 * Asc(Mid(str,i,1)) )<BR>Next<BR>%&#062;<BR><BR>You have to use CHRW because of course doubled characters can be outside the normal Ascii range. You might want to use ASCW as well, depending on the string contents.<BR><BR><BR>

Posting Permissions

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