Retired
Parse IPv6 Address (retired)
Loading description...
Algorithms
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.
This kata expects 1 group of zeroes to be contracted to
::
, which violates the actual IPv6 spec: when there is only 1 group of zeroes0
is retained instead of::
.(This applies to both at the ends and at the middle.)
This kata is a duplicate of https://www.codewars.com/kata/54fa4e210609868fce0002bf
And this kata's test cases are less comprehensive as https://www.codewars.com/kata/5722d87c785220f5780013cf (there are some edge cases that only exists in that kata)
Needs random tests.
Me again. ^ Found some time again for your kata, but gettin the message at test 26 : "False should equal '::FFFF:C0A8:101:A0CD'". Test runs false at my code, because i test for valid segment lengths. Please fix it, or tell me where I'm going wrong! :-D
It is a valid address, all segments have a valid length. The only way a segment can have an invalid length is if it has more than 4 characters - if it has less, it simply has trailing zeros removed.
EDIT: I see what you mean now - there are 3 segments after the FFFF segment. This means that the address is indeed not a valid IPv4-mapped address; it is, however, a valid regular IPv6 address.
thank you! maybe you should update the instructions for noobs like me, and mention that it is neccessary to remove the trailing zeros too. I thought only blocks containing only zeros can be shortened.
Hang on, my bad - trailing zero's shouldn't be removed, leading zeros should be! (although the test in question doesn't have trailing zeros at all)
the second testcase has 8 segments, just as IPv6 should have. Or am I missing something? Nice Kata anyway. :-)
You are correct (I assume you mean the examples in the decsription). Fixed now. Glad you like it!