File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -362,20 +362,7 @@ static string ConvertCaseString(Declaration decl, RenameCasePattern pattern)
362
362
if ( sb [ 0 ] == '@' )
363
363
sb . Remove ( 0 , 1 ) ;
364
364
365
- for ( int i = sb . Length - 1 ; i >= 0 ; i -- )
366
- {
367
- if ( sb [ i ] != '_' ||
368
- // lower case intentional if the first character is already upper case
369
- ( i + 1 < sb . Length && char . IsLower ( sb [ i + 1 ] ) && char . IsUpper ( sb [ 0 ] ) ) ||
370
- // don't end up with more capitals or digits in a row than before
371
- ( i > 0 && ( char . IsUpper ( sb [ i - 1 ] ) ||
372
- ( i < sb . Length - 1 && char . IsDigit ( sb [ i + 1 ] ) && char . IsDigit ( sb [ i - 1 ] ) ) ) ) )
373
- continue ;
374
-
375
- if ( i < sb . Length - 1 )
376
- sb [ i + 1 ] = char . ToUpperInvariant ( sb [ i + 1 ] ) ;
377
- sb . Remove ( i , 1 ) ;
378
- }
365
+ RemoveUnderscores ( sb ) ;
379
366
380
367
var @class = decl as Class ;
381
368
switch ( pattern )
@@ -396,6 +383,24 @@ static string ConvertCaseString(Declaration decl, RenameCasePattern pattern)
396
383
397
384
return sb . ToString ( ) ;
398
385
}
386
+
387
+ private static void RemoveUnderscores ( StringBuilder sb )
388
+ {
389
+ for ( int i = sb . Length - 1 ; i >= 0 ; i -- )
390
+ {
391
+ if ( sb [ i ] != '_' ||
392
+ // lower case intentional if the first character is already upper case
393
+ ( i + 1 < sb . Length && char . IsLower ( sb [ i + 1 ] ) && char . IsUpper ( sb [ 0 ] ) ) ||
394
+ // don't end up with more capitals or digits in a row than before
395
+ ( i > 0 && ( char . IsUpper ( sb [ i - 1 ] ) ||
396
+ ( i < sb . Length - 1 && char . IsDigit ( sb [ i + 1 ] ) && char . IsDigit ( sb [ i - 1 ] ) ) ) ) )
397
+ continue ;
398
+
399
+ if ( i < sb . Length - 1 )
400
+ sb [ i + 1 ] = char . ToUpperInvariant ( sb [ i + 1 ] ) ;
401
+ sb . Remove ( i , 1 ) ;
402
+ }
403
+ }
399
404
}
400
405
401
406
public static class RenamePassExtensions
You can’t perform that action at this time.
0 commit comments