1 Reply Latest reply on Feb 4, 2007 4:00 PM by kenji776

    Large replace statement resulting in all aaaaa

    kenji776 Level 1
      Hello everyone. Been a long time since I posted here. Anyway, I'm trying to build yet another dumb thing for my site, basically a tool to aid monoalphabetic substitution cipher cracking. Basically, users enter what letters should equate to the cipher letters, and the page just replaces all instances of the cipher letters with the ones the users put in. It is pretty simple, but for some reason, the output always comes out as a bunch of a's. I really have no idea why. It's been a while since I've coded and I'm pretty rusty. Any help is greatly appreciated. The code is attached. Also you can see this thing in action at
      There you can get a better idea of what is going on.
      Also, here is a screenshot of the output of my application.
      The out should read "Hello. Wow you broke my code. Good for you."
      Instead it says "aaaaa. aaa aaa aaaaa aa aaaa. aaaa aaa aaa! "
      To break that code I have posted the substitution alphabet is just one letter further than the original, aka A = B, B = C, C = D..... Z = A. Also any optimizations you could point out would be awesome, i can't help but shake the feeling this page is TERRIBLY inefficient, but I'm too rusty to remember how to fix it up.

      EDIT: I Found something out, whatever value Z has, that is what overwrites everything. So Whatever is entered for that form variable is what is replacing everything else, though I still have no idea why.