prepend0x function

String prepend0x(
  1. String input
)

Append "0x" at the begin of a string.

@param input The input string. @return The prepended string.

Implementation

String prepend0x(String input) {
  if (input.startsWith("0x") || input.startsWith("0X")) {
    return input;
  } else {
    return "0x" + input;
  }
}