7 kyu
Nothing special
761 of 1,638EricDalrymple91
Loading description...
Fundamentals
Regular Expressions
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
One of the tests expects special characters to be retained, such as ~ / \ and others. Please fix the task, or remove this test?
Are we expected to insert '\t' in result string when incoming string does not have it? My solution is failing the following input: st = ' S]r(2 (y%nF=<
My result is: result = Sr2ynF I get the following error: ' Sr2ynF' should equal ' Sr2\tynF'
Thanks
I got the same and "solved" it by including \t as an acceptable character. It's a bit weird.
Hi, thank you for sharing your work around. But in this case when I print the original incoming string, I can see that it does not contain '\t' at all, yet it is expected in the output string. I am not sure why?
Prolog translation
PHP:
JS:
mocha
+chai
should be enabledRandom tests do not test for non-string inputs
Fixed in this fork
approved
python new test framework + random tests are required. updated in this fork
Approved
This comment has been hidden.
Added by OP, other languages have them
Simple but great. Really practical kata.
Another error in this app!
The output shows a Vertical Tab symbol, resulting in an error. Vertical tab is a valid whitespace character. Frustrating to find the solution without any credit.
testRandom ✘ Failed asserting that two strings are equal. Expected: 'lqURGNk' Actual : 'lqURG{VT HERE}Nk'
This comment has been hidden.
The \t represents a tab which is a type of whitespace character.
Hi.You said that '' and '/' are not allowed but test still says ✘ ' Sr2ynF' should equal ' Sr2\tynF'
(reposting from below)
@Cptnprice,
' Sr2\tynF' == ' ' + 'S' + 'r' + '2' + '\t' + 'y' + 'n' + 'F'
Thanks for the interjection, Kazk!
Oh okay Thank you :)
This comment has been hidden.
PHP Translation Kumited - please accept :D
APPROVED SOME TIME AGO
I fail on the 11th test: ' Sr2ynF' should equal ' Sr2\tynF' So I added code to check for both "/" and "" and this time I passed the test, just to fail on this instead: 'L urns\B' should equal 'L urnsB'
I'm confused. Should "/" and "" be allowed or not?
They are not allowed, give em the ol' boot!
\t
inSr2\tynF
is a single character. It's a tab (which is whitespace).It's not about
\
or/
(which, on their own, are special).Hi.You said that '' and '/' are not allowed but test still says ✘ ' Sr2ynF' should equal ' Sr2\tynF'
My apologies, JohanWiltink has the right statement.
@Cptnprice,
' Sr2\tynF' == ' ' + 'S' + 'r' + '2' + '\t' + 'y' + 'n' + 'F'
Javascript translation kumited here. I've added some random tests, hope that's ok with you.
I'm pretty new to programming and computers so maybe I'm just ignorant, but I wasn't sure which characters are considered blank space characters (I don't have an exhaustive list). I think it would have helped me to have had a list of them all. It was fun!
This is a suggestion not an issue.
Look under \s.
This comment has been hidden.
Description needs a little fix, it says:
"retains only alpha numeric characters (A-Z both upper and lowercase) and whitespace characters."
While the solution should include digits, which are indeed alpha numeric characters.
Roger that. Check the edited description and let me know if that resolves the issue.
Tests require matching 0-9 digits as well. One of tests: '7Bi&3H=%y4<\t' --> '7Bi3Hy4\t' Please add info about digits requirement and it will be all fixed :) PS: Sorry if you misunderstood me earlier.
How's that?
Done.
The word "spaces" in the description should be changed to "whitespace characters" since it apparently is meant to include horizontal tabs, etc. instead of just the space characters (u"\u0020").
Roger that.
Done.
Is '\x0b' a non-special character ?
I just checked in the test cases and it was just some weird red dots. Not sure why those were there.
Rather than saying to remove special characters, I would suggest providing a set of characters that you're expecting to remain. For example, you might tell them to only return characters in the set: a-z, A-Z, and spaces (or whatever else you want them to return)
I revised the description to say "retain only non-special" characters. Is that what you were suggesting? I was keeping the "special" theme.
I was suggesting that you clearly articulate the characters you want them to retain. Give an example or something, like a-z, A-Z, and spaces. Define what a "non-special" character is.
Cool. How is that update?
Perfect
Nice kata, but needs some random test.
Can you elaborate? Thanks!
I agree, add a number of (50-100) random generated strings to test.
Also, make sure the random tests include the full* range of special characters (including
".,:;{}[]<>?/|
etc.) to avoid this kind of solutions:* Basically, random strings should be generated from the whole range of ASCII characters between 32 and 126.
Is there a quick way to generate random tests? Or do you just mean create the randomly generated strings, and then add them as test cases?
Okay, added a few more random tests to really get things rolling.
Done.
This random test inputs a vertical tab symbol into actual results, finding my solution as invalid. Example tests pass just fine.
Please "unroger" the random test, it is adding line endings that should not be there.
A vertical tab is a ASCII character between 32 and 126. So it is intended to be there. Please change your code to accomadate this.