Help With Working With 'Enter'
Author |
Message |
Slaivis

|
Posted: Sat Jun 24, 2006 10:21 pm Post subject: 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:
Quote: const alpha : string := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+`-={}[]:;'<>?,./1234567890 "
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. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
[Gandalf]

|
Posted: Sat Jun 24, 2006 10:34 pm Post subject: (No subject) |
|
|
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

|
Posted: Sat Jun 24, 2006 10:37 pm Post subject: (No subject) |
|
|
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

|
Posted: Thu Jun 29, 2006 7:19 pm Post subject: (No subject) |
|
|
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  |
|
|
|
|
 |
Slaivis

|
Posted: Thu Jun 29, 2006 10:38 pm Post subject: (No subject) |
|
|
SuperFreak82 wrote: 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 
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]

|
Posted: Thu Jun 29, 2006 11:18 pm Post subject: (No subject) |
|
|
Yep. But not all langauges include an ord function by default, and it's a good introduction to escape characters anyway. |
|
|
|
|
 |
Slaivis

|
Posted: Thu Jun 29, 2006 11:33 pm Post subject: (No subject) |
|
|
[Gandalf] wrote: 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. |
|
|
|
|
 |
|
|