Skip to content

Conversation

@maks-march
Copy link

Наставник @Yaroslav332
Структура
Моя идея заключается в том, что найдя все действующие "inline elements"
сохранить позиции их содержимого в Token-ы чтобы при сборке html
поочередно вставлять в StringBuilder html-тэги из токенов и исходный текст.

}
}

private IEnumerable<Token> FindParagraphTokens(string mark)

Choose a reason for hiding this comment

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

Попробуй найти в классе String метод, который поможет убрать for из этого метода

{
return !isScreened
&& startIndex + markLength < _text.Length
&& _text[startIndex + markLength] != ' ';

Choose a reason for hiding this comment

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

У тебя учитывается только пробел, но есть еще другие пробельные символы, например tab. Используй Char.IsWhiteSpace

{
return start > 0 && _text[start - 1] != ' '
&& end < _text.Length - 1 && _text[end + 1] != ' '
&& _text.Substring(start, end - start).Contains(' ');

Choose a reason for hiding this comment

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

Тут аналогично можно вот так сделать _text.Substring(start, end - start).Any(Char.IsWhiteSpace)

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