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