@@ -26,9 +26,7 @@ import scala.util.matching.Regex
26
26
object StringOps {
27
27
// just statics for companion class.
28
28
private final val LF = 0x0A
29
- private final val FF = 0x0C
30
29
private final val CR = 0x0D
31
- private final val SU = 0x1A
32
30
33
31
private class StringIterator (private [this ] val s : String ) extends AbstractIterator [Char ] {
34
32
private [this ] var pos = 0
@@ -180,14 +178,14 @@ object StringOps {
180
178
final class StringOps (private val s : String ) extends AnyVal {
181
179
import StringOps ._
182
180
183
- @ ` inline` def view : StringView = new StringView (s)
181
+ @ inline def view : StringView = new StringView (s)
184
182
185
- @ ` inline` def size : Int = s.length
183
+ @ inline def size : Int = s.length
186
184
187
- @ ` inline` def knownSize : Int = s.length
185
+ @ inline def knownSize : Int = s.length
188
186
189
187
/** Get the char at the specified index. */
190
- @ ` inline` def apply (i : Int ): Char = s.charAt(i)
188
+ @ inline def apply (i : Int ): Char = s.charAt(i)
191
189
192
190
def sizeCompare (otherSize : Int ): Int = Integer .compare(s.length, otherSize)
193
191
@@ -344,13 +342,13 @@ final class StringOps(private val s: String) extends AnyVal {
344
342
* @return a new string which contains all chars
345
343
* of this string followed by all chars of `suffix`.
346
344
*/
347
- @ ` inline` def concat (suffix : String ): String = s + suffix
345
+ @ inline def concat (suffix : String ): String = s + suffix
348
346
349
347
/** Alias for `concat` */
350
- @ ` inline` def ++ [B >: Char ](suffix : Iterable [B ]): immutable.IndexedSeq [B ] = concat(suffix)
348
+ @ inline def ++ [B >: Char ](suffix : Iterable [B ]): immutable.IndexedSeq [B ] = concat(suffix)
351
349
352
350
/** Alias for `concat` */
353
- @ ` inline` def ++ (suffix : IterableOnce [Char ]): String = concat(suffix)
351
+ @ inline def ++ (suffix : IterableOnce [Char ]): String = concat(suffix)
354
352
355
353
/** Alias for `concat` */
356
354
def ++ (xs : String ): String = concat(xs)
@@ -412,14 +410,14 @@ final class StringOps(private val s: String) extends AnyVal {
412
410
}
413
411
414
412
/** Alias for `prepended` */
415
- @ ` inline` def +: [B >: Char ] (elem : B ): immutable.IndexedSeq [B ] = prepended(elem)
413
+ @ inline def +: [B >: Char ] (elem : B ): immutable.IndexedSeq [B ] = prepended(elem)
416
414
417
415
/** A copy of the string with an char prepended */
418
416
def prepended (c : Char ): String =
419
417
new JStringBuilder (s.length + 1 ).append(c).append(s).toString
420
418
421
419
/** Alias for `prepended` */
422
- @ ` inline` def +: (c : Char ): String = prepended(c)
420
+ @ inline def +: (c : Char ): String = prepended(c)
423
421
424
422
/** A copy of the string with all elements from a collection prepended */
425
423
def prependedAll [B >: Char ](prefix : IterableOnce [B ]): immutable.IndexedSeq [B ] = {
@@ -432,13 +430,13 @@ final class StringOps(private val s: String) extends AnyVal {
432
430
}
433
431
434
432
/** Alias for `prependedAll` */
435
- @ ` inline` def ++: [B >: Char ] (prefix : IterableOnce [B ]): immutable.IndexedSeq [B ] = prependedAll(prefix)
433
+ @ inline def ++: [B >: Char ] (prefix : IterableOnce [B ]): immutable.IndexedSeq [B ] = prependedAll(prefix)
436
434
437
435
/** A copy of the string with another string prepended */
438
436
def prependedAll (prefix : String ): String = prefix + s
439
437
440
438
/** Alias for `prependedAll` */
441
- @ ` inline` def ++: (prefix : String ): String = prependedAll(prefix)
439
+ @ inline def ++: (prefix : String ): String = prependedAll(prefix)
442
440
443
441
/** A copy of the string with an element appended */
444
442
def appended [B >: Char ](elem : B ): immutable.IndexedSeq [B ] = {
@@ -450,28 +448,28 @@ final class StringOps(private val s: String) extends AnyVal {
450
448
}
451
449
452
450
/** Alias for `appended` */
453
- @ ` inline` def :+ [B >: Char ](elem : B ): immutable.IndexedSeq [B ] = appended(elem)
451
+ @ inline def :+ [B >: Char ](elem : B ): immutable.IndexedSeq [B ] = appended(elem)
454
452
455
453
/** A copy of the string with an element appended */
456
454
def appended (c : Char ): String =
457
455
new JStringBuilder (s.length + 1 ).append(s).append(c).toString
458
456
459
457
/** Alias for `appended` */
460
- @ ` inline` def :+ (c : Char ): String = appended(c)
458
+ @ inline def :+ (c : Char ): String = appended(c)
461
459
462
460
/** A copy of the string with all elements from a collection appended */
463
- @ ` inline` def appendedAll [B >: Char ](suffix : IterableOnce [B ]): immutable.IndexedSeq [B ] =
461
+ @ inline def appendedAll [B >: Char ](suffix : IterableOnce [B ]): immutable.IndexedSeq [B ] =
464
462
concat(suffix)
465
463
466
464
/** Alias for `appendedAll` */
467
- @ ` inline` def :++ [B >: Char ](suffix : IterableOnce [B ]): immutable.IndexedSeq [B ] =
465
+ @ inline def :++ [B >: Char ](suffix : IterableOnce [B ]): immutable.IndexedSeq [B ] =
468
466
concat(suffix)
469
467
470
468
/** A copy of the string with another string appended */
471
- @ ` inline` def appendedAll (suffix : String ): String = s + suffix
469
+ @ inline def appendedAll (suffix : String ): String = s + suffix
472
470
473
471
/** Alias for `appendedAll` */
474
- @ ` inline` def :++ (suffix : String ): String = s + suffix
472
+ @ inline def :++ (suffix : String ): String = s + suffix
475
473
476
474
/** Produces a new collection where a slice of characters in this string is replaced by another collection.
477
475
*
@@ -488,7 +486,7 @@ final class StringOps(private val s: String) extends AnyVal {
488
486
*/
489
487
def patch [B >: Char ](from : Int , other : IterableOnce [B ], replaced : Int ): immutable.IndexedSeq [B ] = {
490
488
val len = s.length
491
- @ ` inline` def slc (off : Int , length : Int ): WrappedString =
489
+ @ inline def slc (off : Int , length : Int ): WrappedString =
492
490
new WrappedString (s.substring(off, off+ length))
493
491
val b = immutable.IndexedSeq .newBuilder[B ]
494
492
val k = other.knownSize
@@ -645,8 +643,8 @@ final class StringOps(private val s: String) extends AnyVal {
645
643
646
644
// Note: String.repeat is added in JDK 11.
647
645
/** Return the current string concatenated `n` times.
648
- */
649
- def * (n : Int ): String = {
646
+ */
647
+ def * (n : Int ): String =
650
648
if (n <= 0 ) {
651
649
" "
652
650
} else {
@@ -658,10 +656,9 @@ final class StringOps(private val s: String) extends AnyVal {
658
656
}
659
657
sb.toString
660
658
}
661
- }
662
659
663
- @ ` inline` private [ this ] def isLineBreak (c : Char ) = c == CR || c == LF
664
- @ ` inline` private [ this ] def isLineBreak2 (c0 : Char , c : Char ) = c0 == CR && c == LF
660
+ @ inline private def isLineBreak (c : Char ) = c == CR || c == LF
661
+ @ inline private def isLineBreak2 (c0 : Char , c : Char ) = c0 == CR && c == LF
665
662
666
663
/** Strip the trailing line separator from this string if there is one.
667
664
* The line separator is taken as `"\n"`, `"\r"`, or `"\r\n"`.
@@ -698,7 +695,7 @@ final class StringOps(private val s: String) extends AnyVal {
698
695
699
696
private [this ] val len = s.length
700
697
private [this ] var index = 0
701
- @ ` inline` private def done = index >= len
698
+ @ inline private def done = index >= len
702
699
private def advance (): String = {
703
700
val start = index
704
701
while (! done && ! isLineBreak(apply(index))) index += 1
@@ -1118,7 +1115,7 @@ final class StringOps(private val s: String) extends AnyVal {
1118
1115
* @return The result of applying `op` to `z` and all chars in this string,
1119
1116
* going left to right. Returns `z` if this string is empty.
1120
1117
*/
1121
- @ ` inline` def fold [A1 >: Char ](z : A1 )(op : (A1 , A1 ) => A1 ): A1 = foldLeft(z)(op)
1118
+ @ inline def fold [A1 >: Char ](z : A1 )(op : (A1 , A1 ) => A1 ): A1 = foldLeft(z)(op)
1122
1119
1123
1120
/** Selects the first char of this string.
1124
1121
* @return the first char of this string.
@@ -1158,19 +1155,19 @@ final class StringOps(private val s: String) extends AnyVal {
1158
1155
/** Stepper can be used with Java 8 Streams. This method is equivalent to a call to
1159
1156
* [[charStepper ]]. See also [[codePointStepper ]].
1160
1157
*/
1161
- @ ` inline` def stepper : IntStepper with EfficientSplit = charStepper
1158
+ @ inline def stepper : IntStepper with EfficientSplit = charStepper
1162
1159
1163
1160
/** Steps over characters in this string. Values are packed in `Int` for efficiency
1164
1161
* and compatibility with Java 8 Streams which have an efficient specialization for `Int`.
1165
1162
*/
1166
- @ ` inline` def charStepper : IntStepper with EfficientSplit = new CharStringStepper (s, 0 , s.length)
1163
+ @ inline def charStepper : IntStepper with EfficientSplit = new CharStringStepper (s, 0 , s.length)
1167
1164
1168
1165
/** Steps over code points in this string.
1169
1166
*/
1170
- @ ` inline` def codePointStepper : IntStepper with EfficientSplit = new CodePointStringStepper (s, 0 , s.length)
1167
+ @ inline def codePointStepper : IntStepper with EfficientSplit = new CodePointStringStepper (s, 0 , s.length)
1171
1168
1172
1169
/** Tests whether the string is not empty. */
1173
- @ ` inline` def nonEmpty : Boolean = ! s.isEmpty
1170
+ @ inline def nonEmpty : Boolean = ! s.isEmpty
1174
1171
1175
1172
/** Returns new sequence with elements in reversed order.
1176
1173
* @note $unicodeunaware
@@ -1268,7 +1265,7 @@ final class StringOps(private val s: String) extends AnyVal {
1268
1265
}
1269
1266
1270
1267
/** Selects all chars of this string which do not satisfy a predicate. */
1271
- @ ` inline` def filterNot (pred : Char => Boolean ): String = filter(c => ! pred(c))
1268
+ @ inline def filterNot (pred : Char => Boolean ): String = filter(c => ! pred(c))
1272
1269
1273
1270
/** Copy chars of this string to an array.
1274
1271
* Fills the given array `xs` starting at index 0.
@@ -1277,7 +1274,7 @@ final class StringOps(private val s: String) extends AnyVal {
1277
1274
*
1278
1275
* @param xs the array to fill.
1279
1276
*/
1280
- @ ` inline` def copyToArray (xs : Array [Char ]): Int =
1277
+ @ inline def copyToArray (xs : Array [Char ]): Int =
1281
1278
copyToArray(xs, 0 , Int .MaxValue )
1282
1279
1283
1280
/** Copy chars of this string to an array.
@@ -1288,7 +1285,7 @@ final class StringOps(private val s: String) extends AnyVal {
1288
1285
* @param xs the array to fill.
1289
1286
* @param start the starting index.
1290
1287
*/
1291
- @ ` inline` def copyToArray (xs : Array [Char ], start : Int ): Int =
1288
+ @ inline def copyToArray (xs : Array [Char ], start : Int ): Int =
1292
1289
copyToArray(xs, start, Int .MaxValue )
1293
1290
1294
1291
/** Copy chars of this string to an array.
0 commit comments