lastIndexOf() private method

private lastIndexOf ( global par0 ) : int
par0 global
return int
Ejemplo n.º 1
0
 // Some national prefixes are a substring of others. If extracting the shorter NDD doesn't result
 // in a number we can format, we try to see if we can extract a longer version here.
 private boolean ableToExtractLongerNdd()
 {
     if (nationalPrefixExtracted.length() > 0)
     {
         // Put the extracted NDD back to the national number before attempting to extract a new NDD.
         nationalNumber.insert(0, nationalPrefixExtracted);
         // Remove the previously extracted NDD from prefixBeforeNationalNumber. We cannot simply set
         // it to empty string because people sometimes incorrectly enter national prefix after the
         // country code, e.g. +44 (0)20-1234-5678.
         int indexOfPreviousNdd = prefixBeforeNationalNumber.lastIndexOf(nationalPrefixExtracted);
         prefixBeforeNationalNumber.setLength(indexOfPreviousNdd);
     }
     return(!nationalPrefixExtracted.equals(removeNationalPrefixFromNationalNumber()));
 }