quote property

String quote

Quotes the String adding "" at the start & at the end.

Removes all " characters from the String before adding the quotes.

Example

String text = '"""Is this real"';
String quote = text.quote; // "Is this real"

Implementation

String get quote {
  if (this.isBlank) {
    return this;
  }

  String normalizedString = this.replaceAll('"', '');

  return normalizedString.append('"').prepend('"');
}