// src/utils/strings.tsx
var capitalize = (str) => {
  if (str.length === 0) {
    return str;
  }
  return str.charAt(0).toUpperCase() + str.slice(1);
};
var makeEnumPretty = (enumValue, capitalizeAllWords = true) => {
  let formatted = enumValue.toLowerCase().split("_");
  if (capitalizeAllWords) {
    formatted = formatted.map((word) => capitalize(word));
  } else if (formatted.length > 0) {
    formatted[0] = capitalize(formatted[0]);
  }
  return formatted.join(" ");
};
var elide = (s, first, last) => {
  if (s === void 0 || s === null)
    return s;
  return s.substring(0, first) + "..." + s.substring(s.length - (last != null ? last : 0));
};
function removeChars(value, beginIndex, endIndex) {
  return value.slice(0, beginIndex) + value.slice(endIndex || beginIndex + 1);
}
function isString(str) {
  return typeof str === "string";
}
function removeCommas(value) {
  return value.replace(/,/g, "");
}
function addCommasToDigits(value) {
  if (typeof value === "number") {
    value = value.toString();
  }
  const existingCommasRemoved = removeCommas(value);
  const [int, decimal] = existingCommasRemoved.split(".");
  const intWithCommas = int.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  return decimal ? `${intWithCommas}.${decimal}` : intWithCommas;
}
function removeLeadingZeros(value) {
  if (value.length > 1) {
    return value.replace(/^0+(?=\d)/, "");
  }
  return value;
}

export {
  capitalize,
  makeEnumPretty,
  elide,
  removeChars,
  isString,
  removeCommas,
  addCommasToDigits,
  removeLeadingZeros
};
