Skip to content

Commit bb8df6b

Browse files
committed
Restore startsWith and endsWith overloads taking single char to keep binary compatibility with markdown parser.
1 parent b3165ac commit bb8df6b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

libraries/stdlib/src/kotlin/text/Strings.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,15 +468,26 @@ public fun String.replaceBeforeLast(delimiter: String, replacement: String, miss
468468
/**
469469
* Returns `true` if this string starts with the specified character.
470470
*/
471-
public fun String.startsWith(char: Char, ignoreCase: Boolean = false): Boolean =
471+
public fun String.startsWith(char: Char, ignoreCase: Boolean): Boolean =
472472
this.length() > 0 && this[0].equals(char, ignoreCase)
473473

474+
/**
475+
* Returns `true` if this string starts with the specified character.
476+
*/
477+
// TODO: temporary overload to keep binary compatibility, remove after fixing markdown parser
478+
public fun String.startsWith(char: Char): Boolean = startsWith(char, ignoreCase = false)
479+
474480
/**
475481
* Returns `true` if this string ends with the specified character.
476482
*/
477-
public fun String.endsWith(char: Char, ignoreCase: Boolean = false): Boolean =
483+
public fun String.endsWith(char: Char, ignoreCase: Boolean): Boolean =
478484
this.length() > 0 && this[lastIndex].equals(char, ignoreCase)
479485

486+
/**
487+
* Returns `true` if this string ends with the specified character.
488+
*/
489+
// TODO: temporary overload to keep binary compatibility, remove after fixing markdown parser
490+
public fun String.endsWith(char: Char): Boolean = endsWith(char, ignoreCase = false)
480491

481492
// indexOfAny()
482493

0 commit comments

Comments
 (0)