tigertv / secretpy

Classical ciphers: Caesar, ADFGX, ROT13 and etc.
https://pypi.org/project/secretpy/
MIT License
61 stars 10 forks source link

Non-existing character in an alphabet #3

Closed tigertv closed 4 years ago

tigertv commented 4 years ago

Conclusions from #2: Handle exceptions when a character doesn't exist in an alphabet. A solution would be either to show an error message or remove non-existing characters from message.

ZetaTwo commented 3 years ago

At least for Caesar it would be good to be able to just leave the character in place.

tigertv commented 3 years ago

Hi @ZetaTwo !

... just leave the character in place.

Developer decides how to handle the situation, he uses either a 'try-catch' or correct input(only characters from alphabet). Also developer can use the wrappers 'SaveAll' and 'RemoveNonAlphabet' which save and remove non-alphabet characters correspondingly: https://github.com/tigertv/secretpy/blob/b87b822cbd9776660e51c4cf7ccbaaeec97faab0/examples/caesar.py#L42-L48

ZetaTwo commented 3 years ago

Also developer can use the wrappers 'SaveAll' and 'RemoveAll'

Perfect. This was exactly what I was looking for. Thank you.

tigertv commented 3 years ago

You are welcome!