diff --git a/src/libraries/System.Private.CoreLib/src/System/Guid.cs b/src/libraries/System.Private.CoreLib/src/System/Guid.cs index 078ceedb0b68cb..b488f144fdab09 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Guid.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Guid.cs @@ -900,9 +900,8 @@ private static ReadOnlySpan EatAllWhitespace(ReadOnlySpan s { ReadOnlySpan charSpan = Unsafe.BitCast, ReadOnlySpan>(str); // Find the first whitespace character. If there is none, just return the input. - int i; - for (i = 0; i < charSpan.Length && !char.IsWhiteSpace(charSpan[i]); i++) ; - if (i == charSpan.Length) + int i = charSpan.IndexOfAnyWhiteSpace(); + if (i < 0) { return str; }