• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Large replace statement resulting in all aaaaa

Guest
Feb 04, 2007 Feb 04, 2007

Copy link to clipboard

Copied

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
http://www.digitalswordsmen.com/codebreaker.cfm
There you can get a better idea of what is going on.
Also, here is a screenshot of the output of my application.
http://www.digitalswordsmen.com/img/output.bmp
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.

TOPICS
Advanced techniques

Views

164

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 04, 2007 Feb 04, 2007

Copy link to clipboard

Copied

LATEST
Ah, I solved my problem, the order in my replace list was wrong, just had to flop that around. It was causing some very strange results. Still if you have any optimizations please let me know.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation