isSlug method

bool isSlug()

Checks if the string is a valid slug. This method compares the original string to its slugified version to determine if it is a valid slug. Returns true if the string is a valid slug; otherwise, returns false.

Implementation

bool isSlug() {
  return this == toSlug();
}