Checks to see if a string is less than/more than a maximum length specified - Node.js String

Node.js examples for String:Parse

Description

Checks to see if a string is less than/more than a maximum length specified

Demo Code


// Checks to see if a string is less than a maximum length specified
function isLessMaxLen(a_string, max_len) {
  if (a_string.length <= max_len) {
    return true;/*from ww w .  ja  va2s  .c  om*/
  } else {
    return false;
  }
}

//Checks to see if a string is more than a minimum length specified
function isMoreMinLen(a_string, min_len) {
  if (a_string.length >= min_len) {
    return true;
  } else {
    return false;
  }
}

Related Tutorials