Introduce StringBuilder.appendLine in stdlib-common #KT-37839

This commit is contained in:
Abduqodiri Qurbonzoda
2020-04-02 12:54:50 +03:00
parent d7667209b2
commit 08ff52bee4
4 changed files with 230 additions and 0 deletions
@@ -158,6 +158,47 @@ public actual inline fun StringBuilder.insertRange(index: Int, value: CharSequen
this.insert(index, value, startIndex, endIndex)
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendLine(value: StringBuffer?): StringBuilder = append(value).appendLine()
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendLine(value: StringBuilder?): StringBuilder = append(value).appendLine()
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendLine(value: Int): StringBuilder = append(value).appendLine()
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendLine(value: Short): StringBuilder = append(value.toInt()).appendLine()
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendLine(value: Byte): StringBuilder = append(value.toInt()).appendLine()
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendLine(value: Long): StringBuilder = append(value).appendLine()
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendLine(value: Float): StringBuilder = append(value).appendLine()
/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendLine(value: Double): StringBuilder = append(value).appendLine()
private object SystemProperties {
/** Line separator for current system. */
@JvmField
@@ -165,71 +206,177 @@ private object SystemProperties {
}
/** Appends a line separator to this Appendable. */
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine()"),
level = DeprecationLevel.WARNING
)
public fun Appendable.appendln(): Appendable = append(SystemProperties.LINE_SEPARATOR)
/** Appends value to the given Appendable and line separator after it. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun Appendable.appendln(value: CharSequence?): Appendable = append(value).appendln()
/** Appends value to the given Appendable and line separator after it. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun Appendable.appendln(value: Char): Appendable = append(value).appendln()
/** Appends a line separator to this StringBuilder. */
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine()"),
level = DeprecationLevel.WARNING
)
public fun StringBuilder.appendln(): StringBuilder = append(SystemProperties.LINE_SEPARATOR)
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: StringBuffer?): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: CharSequence?): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: String?): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Any?): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: StringBuilder?): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: CharArray): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Char): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Boolean): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Int): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Short): StringBuilder = append(value.toInt()).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Byte): StringBuilder = append(value.toInt()).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Long): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Float): StringBuilder = append(value).appendln()
/** Appends [value] to this [StringBuilder], followed by a line separator. */
@Suppress("DEPRECATION")
@Deprecated(
"Use appendLine instead. Note that the new method always appends the line feed character '\\n' regardless of the system line separator.",
ReplaceWith("appendLine(value)"),
level = DeprecationLevel.WARNING
)
@kotlin.internal.InlineOnly
public inline fun StringBuilder.appendln(value: Double): StringBuilder = append(value).appendln()