Skip to content

Conversation

@MihaZupan
Copy link
Collaborator

// Previous char must be a whitespace or a punctuation
var previousChar = slice.PeekCharExtra(-1);
if (!IsValidPreviousCharacter(previousChar))
if (!previousChar.IsWhiteSpaceOrZero() && ValidPreviousCharacters.IndexOf(previousChar) == -1)
Copy link
Owner

Choose a reason for hiding this comment

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

Couldn't we use ValidPreviousCharacters.Contains here instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could, but I think that IndexOf should be faster since string.Contains(char) is a Linq extension.
I haven't tested the difference tho.

Copy link
Owner

Choose a reason for hiding this comment

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

Han yes, sorry, actually you are right. IndexOf will be way faster then

@xoofx xoofx merged commit ce3078d into xoofx:master Oct 29, 2018
@xoofx
Copy link
Owner

xoofx commented Oct 29, 2018

Thanks for this!

@MihaZupan MihaZupan deleted the autolink-prev-chars branch March 11, 2019 17:34
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