wrap

fun StringBuilder.wrap(prefix: String, suffix: String, body: StringBuilder.() -> Unit)

With the given StringBuilder, append the prefix, run the body, and append the suffix. Attempt to append the suffix even if the body fails.

Parameters

prefix

The first string to append.

suffix

The last string to append.

body

The body function that produces the middle part.