public static String updateIPv6(String src) { // if the ip address has "[" and "]" then it's IPv6, check that it's long form as well if ((src != null) && (src.indexOf('[') != -1) && (src.indexOf(']') != -1)) { // then, it's IPv6 and remove the square brackets and update to long form if required int start = src.indexOf('['); int end = src.indexOf(']'); StringBuffer updated = new StringBuffer(src.substring(0, start + 1)); updated.append(updateToLongForm(src.substring(start + 1, end))); updated.append(src.substring(end)); return updated.toString(); } else { return src; } }
/** * Update IPv6 IP address. * @param src the source IP address string * @return String the updated IP address string */ public static String updateIPv6(String src) { // if the ip address has "[" and "]" then it's IPv6, check that it's long form as well if ((src != null) && (src.indexOf('[') != -1) && (src.indexOf(']') != -1)) { // then, it's IPv6 and remove the square brackets and update to long form if required int start = src.indexOf('['); int end = src.indexOf(']'); StringBuffer updated = new StringBuffer(src.substring(0, start + 1)); updated.append(updateToLongForm(src.substring(start + 1, end))); updated.append(src.substring(end)); return updated.toString(); } else { return src; } }
/** * Update IPv6 IP address. * @param src the source IP address string * @return String the updated IP address string */ public static String updateIPv6(String src) { // if the ip address has "[" and "]" then it's IPv6, check that it's long form as well if ((src != null) && (src.indexOf('[') != -1) && (src.indexOf(']') != -1)) { // then, it's IPv6 and remove the square brackets and update to long form if required int start = src.indexOf('['); int end = src.indexOf(']'); StringBuffer updated = new StringBuffer(src.substring(0, start + 1)); updated.append(updateToLongForm(src.substring(start + 1, end))); updated.append(src.substring(end)); return updated.toString(); } else { return src; } }