replaceIndentByMargin
Detects indent by marginPrefix as it does trimMargin and replace it with newIndent.
fun String.replaceIndentByMargin(newIndent: String = "", marginPrefix: String = "|"): String(source)
val source = """
| first line
| second line
""".trimIndent()
// Replace the indent before the margin prefix with a tab character
val result = source.replaceIndentByMargin(newIndent = "\t", marginPrefix = "|")
println(result)
// Output:
// first line
// second line