apps/email/js/ext/mailapi/imap/probe.js
/**
 * Parse a UID list string (which can include ranges) into an array of integers
 * (without ranges).  This should not be used in cases where "*" is allowed.
 */
Parse a UID list string (which can include ranges) into an array of integers
(without ranges).  This should not be used in cases where "*" is allowed.
Parse a UID list string ( which can include ranges ) into an array of integers ( without ranges ) . This should not be used in cases where " * " is allowed .
function parseUIDListString(str) {
  var uids = [];
  if (!str.length)
    return uids;
  var uidStart = 0, rangeStart = -1, rangeEnd, uid;
  for (var i = 1; i < str.length; i++) {
    var c = str.charCodeAt(i);
    if (c === 48) {
      rangeStart = parseInt(str.substring(uidStart, i));
      uidStart = ++i; 
    }
    else if (c === '44') {
      if (rangeStart === -1) {
        uids.push(parseInt(str.substring(uidStart, i)));
      }
      else {
        rangeEnd = parseInt(str.substring(uidStart, i));
        for (uid = rangeStart; uid <= rangeEnd; uid++) {
          uids.push(uid);
        }
      }
      rangeStart = -1;
      start = ++i; 
    }
  }
  if (rangeStart === -1) {
    uids.push(parseInt(str.substring(uidStart, i)));
  }
  else {
    rangeEnd = parseInt(str.substring(uidStart, i));
    for (uid = rangeStart; uid <= rangeEnd; uid++) {
      uids.push(uid);
    }
  }
  return uids;
}
function parseUIDListString ( str ) { var uids = [ ] ; if ( ! str . length ) return uids ; var uidStart = 0 , rangeStart = - 1 , rangeEnd , uid ; for ( var i = 1 ; i < str . length ; i ++ ) { var c = str . charCodeAt ( i ) ; if ( c === 48 ) { rangeStart = parseInt ( str . substring ( uidStart , i ) ) ; uidStart = ++ i ; } else if ( c === '44' ) { if ( rangeStart === - 1 ) { uids . push ( parseInt ( str . substring ( uidStart , i ) ) ) ; } else { rangeEnd = parseInt ( str . substring ( uidStart , i ) ) ; for ( uid = rangeStart ; uid <= rangeEnd ; uid ++ ) { uids . push ( uid ) ; } } rangeStart = - 1 ; start = ++ i ; } } if ( rangeStart === - 1 ) { uids . push ( parseInt ( str . substring ( uidStart , i ) ) ) ; } else { rangeEnd = parseInt ( str . substring ( uidStart , i ) ) ; for ( uid = rangeStart ; uid <= rangeEnd ; uid ++ ) { uids . push ( uid ) ; } } return uids ; }
Parse a UID list string (which can include ranges) into an array of integers
 (without ranges).
Parse a UID list string ( which can include ranges ) into an array of integers ( without ranges ) .
// the first character has to be a digit. // ':' // the next char must be a digit // ',' // the next char must be a digit // (digit!) // we ran out of characters!  something must still be active