I have a method that takes a single line, and it should get a line with exactly 5 characters.
There is a possibility that the user inserts a line with more than 5 characters - in this case I want to trim to the left.
There is a possibility that the user will enter a string with more than 5 characters - in this case I want the panel on the left.
I know that I can do this with the if / else condition, but I'm wondering, maybe the string class has something useful to solve such cases in one command.
What do you think?
source
share