Skip to content

Conversation

@shtykhnoia
Copy link

implemented the function by creating a new array of char, and shifting the elements of the substring using a loop

Comment on lines +487 to +488
TString s1 = stringInitWithCharArr("abcdef");
TString s2 = stringInitWithCharArr("123");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more test cases


TString s1expected = stringInitWithCharArr("ab123cdef");

assertEq(strncmp(s1.data, s1expected.data, stringLen(s1expected)), 0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use stringCompare from this library

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally good job)

Comment on lines +972 to +973
s->data = new_data;
s->size = len_str + len_sub;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what about s->capacity???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants