strip0x static method

String strip0x(
  1. String value
)

Removes the '0x' prefix from a hexadecimal string if it exists.

If the input value starts with '0x', this method returns the substring of value without those two characters. If value does not start with '0x', it returns the original value.

Implementation

static String strip0x(String value) {
  if (value.toLowerCase().startsWith("0x")) {
    return value.substring(2);
  }
  return value;
}