Skip to content

Conversation

@vladlead5
Copy link

Реализация функция stringCapitalize

Comment on lines +504 to +505
TString s = stringInitWithCharArr("hello, world!");
stringCapitalize(&s);
Copy link
Owner

Choose a reason for hiding this comment

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

Добавьте ещё больше разнообразных тестов

s->data[i] = stringCharToLower(s->data[i]);
}

if (s->data[i] == ' ' || s->data[i] == '\t' || s->data[i] == '\n') {
Copy link
Owner

Choose a reason for hiding this comment

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

Добавьте в разделитель ещё ., ,, !, : и другие знаки препинания

Copy link
Owner

Choose a reason for hiding this comment

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

В остальном всё хорошо!

s->data[i] = stringCharToUpper(s->data[i]);
capitalizeNext = false;
} else {
s->data[i] = stringCharToLower(s->data[i]);
Copy link
Owner

Choose a reason for hiding this comment

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

Не нужно приводить букву к нижнему регистру. Функция только делает первую букву каждого слова большой (если это буква)

test_stringPad();
test_stringRemove();
test_stringToInt();
// test_stringToInt();
Copy link
Owner

Choose a reason for hiding this comment

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

Почему закомментирован старый тест?

return number + decimal;
}

void stringCapitalize(TString *s) {

Choose a reason for hiding this comment

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

Chat-GPT ❤️

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.

3 participants