0xwal / c-scratch

Essential programming tasks from scratch as a challenge and exercise. 🧩
MIT License
4 stars 1 forks source link

Find and Replace text in c #1

Open 0xwal opened 3 years ago

0xwal commented 3 years ago

Find and Replace Text

Description:

We need to write a function to replace the first found occurrence

in the input with the given replacement text.

Details:

Header:

src/include/string_replace.h

Source file:

src/string_replace.c

Test file:

tests/string_replace.test.cpp

Signature:

char* string_replace_first_occurence(const char* text, const char* replacement, const char* input);

Restriction:

Note:

See Contribution Guide for more details.

Let me know if you are unable to write the tests, I will do that for you.

Also if you want any help let me know 😉.

0xwal commented 3 years ago

Example of the workflow, look at this closed issue #2 .

sachin-vinod commented 3 years ago

can anyone please explain what actually we have to do for resolve this issue

0xwal commented 3 years ago

@sachin-vinod make a function to replace a given sequence of a text and replace it with another given text. for example: input: Hello World to find: World replacement text: Universe

result: Hello Universe

let me know if you want further help. thanks for being interested. 🥰

sachin-vinod commented 3 years ago

i want to work on this issue

0xwal commented 3 years ago

sure go ahead

ghost commented 2 years ago

Check out this function i wrote up, Which suits your needs (the code does not use string.h and relies on memory management functions like malloc and free)