unQuoteJsResponseIfNeeded static method

String unQuoteJsResponseIfNeeded(
  1. String rawJsResponse
)

Removes surrounding quotes around a string, if any

Implementation

static String unQuoteJsResponseIfNeeded(String rawJsResponse) {
  if ((rawJsResponse.startsWith('"') && rawJsResponse.endsWith('"')) ||
      (rawJsResponse.startsWith("'") && rawJsResponse.endsWith("'"))) {
    return rawJsResponse.substring(1, rawJsResponse.length - 1);
  }
  return rawJsResponse;
}