@@ -167,7 +167,11 @@ func (StdConverter) writeIndexReplacement(b *strings.Builder, style Style, repSt
167
167
b .WriteString (rep .Camel )
168
168
}
169
169
case ReplaceStyleScreaming :
170
- b .WriteString (rep .Screaming )
170
+ if b .Len () == 0 && style == StyleLowerCamel {
171
+ b .WriteString (rep .Lower )
172
+ } else {
173
+ b .WriteString (rep .Screaming )
174
+ }
171
175
case ReplaceStyleLower :
172
176
b .WriteString (rep .Lower )
173
177
default :
@@ -241,7 +245,6 @@ func (sc StdConverter) Convert(req ConvertRequest) string {
241
245
if idx , ok = idx .Match (tok ); ! ok {
242
246
if idx .LastMatch ().HasValue () {
243
247
// appending the last match
244
- // formatIndexedReplacement(req.Style, req.ReplaceStyle, b.Len(), idx.LastMatch()), req.Join
245
248
sc .writeIndexReplacement (b , req .Style , req .ReplaceStyle , req .Join , idx .LastMatch ())
246
249
}
247
250
if idx .HasPartialMatches () {
@@ -285,21 +288,11 @@ func (sc StdConverter) Convert(req ConvertRequest) string {
285
288
}
286
289
if idx .HasMatched () {
287
290
sc .writeIndexReplacement (b , req .Style , req .ReplaceStyle , req .Join , idx .LastMatch ())
288
- // parts = append(parts, formatIndexedReplacement(req.Style, req.ReplaceStyle, len(parts), idx.LastMatch()))
289
291
}
290
292
291
293
if idx .HasPartialMatches () {
292
294
sc .writeReplaceSplit (b , req .Style , req .Join , idx .PartialMatchRunes ())
293
295
}
294
- // for _, part := range parts {
295
- // if shouldWriteDelimiter {
296
- // result.WriteString(req.Join)
297
- // }
298
- // result.WriteString(part)
299
- // if !shouldWriteDelimiter {
300
- // shouldWriteDelimiter = len(part) > 0 && len(req.Join) > 0
301
- // }
302
- // }
303
296
304
297
return b .String ()
305
298
}
0 commit comments