
-----------------------------------
Slaivis
Sat Jun 24, 2006 10:21 pm

Help With Working With 'Enter'
-----------------------------------
Alright, you may have read the title and thought 'Oh, easy... Just use ""'.

The thing is... My problem is a bit.. Weird.  I don't know how to phrase it.

I'll start with what my program does. It's a program to switch the characters in a message with other, seemingly random characters.

My program can also unencode a message.

Here's what my alphabet looks like:

const alpha : string := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+`-={}

Now, the problem comes in with the "enter" key. I would like my program to be able to read and output enter as it is, without encoding it.

However, as it is right now, my program will read enter, and output "I", no matter the location of the enter within the message.

Is there some way to make the "Enter" key a part of the alphabet?

Thanks for your help, it will be greatly appreciated.

-----------------------------------
[Gandalf]
Sat Jun 24, 2006 10:34 pm


-----------------------------------
Your question is a bit confusing, but I believe what you are looking for is the escaped newline character.  Try adding "\n" to your alphabet, and treat the \ with the n as one letter, that letter being the enter character as you referred to it.

-----------------------------------
Slaivis
Sat Jun 24, 2006 10:37 pm


-----------------------------------
I've read about special characters using a combination of \ and some other letter.

And you know what, I think that might be what I was looking for.


Thanks a ton!

-----------------------------------
Clayton
Thu Jun 29, 2006 7:19 pm


-----------------------------------
why not just use the enter key's ordinal value (10) in your alphabet string? just add it in on the end and treat "10" as one item :D

-----------------------------------
Slaivis
Thu Jun 29, 2006 10:38 pm


-----------------------------------
why not just use the enter key's ordinal value (10) in your alphabet string? just add it in on the end and treat "10" as one item :D

Actually, the previous idea solved the problem very well.

But assuming that I were to use your idea...

Would I simply add ORD(10) to the end of the string via concantenation?

-----------------------------------
[Gandalf]
Thu Jun 29, 2006 11:18 pm


-----------------------------------
Yep.  But not all langauges include an ord function by default, and it's a good introduction to escape characters anyway.

-----------------------------------
Slaivis
Thu Jun 29, 2006 11:33 pm


-----------------------------------
"]Yep.  But not all langauges include an ord function by default, and it's a good introduction to escape characters anyway.

Heh, cool, thanks.

Now if I find some time, I can go improve the program then optimize it.
