dsbenghe / Novell.Directory.Ldap.NETStandard

.NET LDAP client library for .NET Standard >= 2.0, .NET Core >=1.0, NET5/NET6/NET7/NET8 - works with any LDAP protocol compatible directory server (including Microsoft Active Directory).
MIT License
558 stars 153 forks source link

Rework Tokenizer #254

Closed TheConstructor closed 5 months ago

TheConstructor commented 6 months ago

I reworked Tokenizer, trying to remove the repeated splitting, as the elements were all already there and utilizing the built-in StringSplitOptions.RemoveEmptyEntries.

In doing this I found, that the current implementation would return a string twice, if it does not contain delimiters and the tokenizer is asked to return the delimiters. This is cause by Tokenize() not returning or setting tempstr to empty after if (tempstr.IndexOfAny(_delimiters.ToCharArray()) < 0 && tempstr.Length > 0), so that it is added again by the last if in that method.