From 259b21978ea3be42ac0226a9ff11edcc3da92d3d Mon Sep 17 00:00:00 2001 From: Tydude4Christ Date: Wed, 2 Mar 2016 08:59:37 -0600 Subject: [PATCH] While loop is a bit cleaner --- Src/Newtonsoft.Json/Utilities/StringUtils.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Src/Newtonsoft.Json/Utilities/StringUtils.cs b/Src/Newtonsoft.Json/Utilities/StringUtils.cs index b1b56d90..122fc837 100644 --- a/Src/Newtonsoft.Json/Utilities/StringUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/StringUtils.cs @@ -178,8 +178,9 @@ namespace Newtonsoft.Json.Utilities char[] chars = s.ToCharArray(); int toLowerUntilIndex = 1; - for(; toLowerUntilIndex < chars.Length && char.IsUpper(chars[toLowerUntilIndex]); ++toLowerUntilIndex) + while (toLowerUntilIndex < chars.Length && char.IsUpper(chars[toLowerUntilIndex])) { + ++toLowerUntilIndex; } // decrement if starts with consecutive upper case letters but is not all upper if (toLowerUntilIndex > 1 && toLowerUntilIndex < chars.Length)