function format(string) {
    string = trim(string);
    return /^(?:webOS|i(?:OS|P))/.test(string)
      ? string
      : capitalize(string);
  }
Trim and conditionally capitalize string values.

@private
@param {string} string The string to format.
@returns {string} The formatted string.