code: public final ValueWithPos<String> formatE123NationalWithPos(
        final ValueWithPos<PhoneNumberData> pphoneNumberData) {
      if (pphoneNumberData == null) {
        return null;
      }
      int cursor = pphoneNumberData.getPos();
      final StringBuilder resultNumber = new StringBuilder();
      if (isPhoneNumberNotEmpty(pphoneNumberData.getValue())) {
        PhoneCountryData phoneCountryData = null;
        for (final PhoneCountryCodeData country : CreatePhoneCountryConstantsClass.create()
            .countryCodeData()) {
          if (StringUtils.equals(country.getCountryCode(),
              pphoneNumberData.getValue().getCountryCode())) {
            phoneCountryData = country.getPhoneCountryData();
            break;
          }
        }
        if (phoneCountryData == null) {
          return this.formatE123InternationalWithPos(pphoneNumberData);
        }
        if (cursor > 0) {
          cursor -= StringUtils.length(pphoneNumberData.getValue().getCountryCode());
          cursor += StringUtils.length(phoneCountryData.getTrunkCode());
        }
        cursor++;
        resultNumber.append('(').append(phoneCountryData.getTrunkCode());
        if (StringUtils.isNotBlank(pphoneNumberData.getValue().getAreaCode())) {
          resultNumber.append(pphoneNumberData.getValue().getAreaCode());
        }
        if (resultNumber.length() <= cursor) {
          cursor += 2;
        }
        resultNumber.append(") ");
        resultNumber.append(pphoneNumberData.getValue().getLineNumber());
        if (StringUtils.isNotBlank(pphoneNumberData.getValue().getExtension())) {
          if (resultNumber.length() <= cursor) {
            cursor++;
          }
          resultNumber.append(' ');
          resultNumber.append(pphoneNumberData.getValue().getExtension());
        }
      }
      return new ValueWithPos<>(StringUtils.trimToNull(resultNumber.toString()), cursor);
    }
docs: format phone number in E123 national format with cursor position handling.
  
  @param pphoneNumberData phone number to format with cursor position
  @return formated phone number as String with new cursor position