-Refactored ToCamelCase
This commit is contained in:
@@ -177,19 +177,19 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
char[] chars = s.ToCharArray();
|
char[] chars = s.ToCharArray();
|
||||||
|
|
||||||
int toLowerUntilIndex = 1;
|
for (int i = 0; i < chars.Length; i++)
|
||||||
while (toLowerUntilIndex < chars.Length && char.IsUpper(chars[toLowerUntilIndex]))
|
|
||||||
{
|
{
|
||||||
++toLowerUntilIndex;
|
if (i == 1 && !char.IsUpper(chars[i]))
|
||||||
}
|
{
|
||||||
// decrement if starts with consecutive upper case letters but is not all upper
|
break;
|
||||||
if (toLowerUntilIndex > 1 && toLowerUntilIndex < chars.Length)
|
}
|
||||||
{
|
|
||||||
--toLowerUntilIndex;
|
bool hasNext = (i + 1 < chars.Length);
|
||||||
}
|
if (i > 0 && hasNext && !char.IsUpper(chars[i + 1]))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < toLowerUntilIndex; ++i)
|
|
||||||
{
|
|
||||||
#if !(DOTNET || PORTABLE)
|
#if !(DOTNET || PORTABLE)
|
||||||
chars[i] = char.ToLower(chars[i], CultureInfo.InvariantCulture);
|
chars[i] = char.ToLower(chars[i], CultureInfo.InvariantCulture);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user