6 kyu
Strings: filter out the Wikipedia reference marks from text
128 of 137lilsweetcaligula
Loading description...
Strings
Filtering
Algorithms
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.
Since you are insisting on modifying the input buffer and return it (which is not tested in any sample or fixed test) you should at least mention this in the description or the initial solution setup. I don't want to guess this from the fact that the signature doesn't declare
source
asconst char*
.This comment has been hidden.
You are expected to modify the given
source
buffer in-place and not allocate a new buffere. I opened a separate issue to clarify this somewhere.Thank you. Issue has solved.
This comment has been hidden.
If the input string doesn't contain any reference marks, your code just increases
i
until out of bounds.Doing the NASM-version
I pass the Test, and fail all on Attempt.
Output is :
However, it is not what I return.
I output this to the concole just before exiting.
There may very well be errors in the string I return. I do however not return the string listed as actual.
Please, NASM Translation
As mentioned below, if modifications are done in place then the function return type should be
void
, notchar*
.Please, close the issue! See the reason below...
;-)
Great!
Sorry but I can see no reason below... At least it should be specified in the description.
Why do we need to return a
char*
if the modifications are done in-place on the parameter?Indeed! It's a standard way to return something useful and considered to be
BestPractices
! Here are some of string functions from the standard library that do it the similar way: strcpy:char *strcpy(char *dest, const char *src);
strcat:
char *strcat(char *dest, const char *src);
Consider this code:
And this one:
The first is more convenient and more compact especially if there are dozens of them... Sure, there are better explanations and better applications than these ones!
;-)