prepend method

String prepend(
  1. String prefix
)

Prepends a prefix to the String.

Example

String foo = 'world';
String newFoo = foo1.prepend('hello '); // returns 'hello world'

Implementation

String prepend(String prefix) {
  if (this.isBlank) {
    return prefix;
  }

  return prefix + this;
}