Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-16-2019 12:07 AM
Hello!
I'm currently trying to convert hexadecimal ip address into A.B.C.D format.
This ip field is a string "0a0a0b43" for exemple and the result has to be 10.10.11.67
I've done some attempts but whitout success...
By advance, thanks you
Solved! Go to Solution.
05-16-2019 02:59 AM
05-16-2019 02:46 AM
Hi,
There are some libraries in java which can convert hex to string and you may use that.
And then you can make a user defined function of it.
java example:
public static String convertHexToIP(String hex)
{
String ip= "";
for (int j = 0; j < hex.length(); j+=2) {
String sub = hex.substring(j, j+2);
int num = Integer.parseInt(sub, 16);
ip += num+".";
}
ip = ip.substring(0, ip.length()-1);
return ip;
}
a more generic approach is described here: https://www.mkyong.com/java/how-to-convert-hex-to-ascii-in-java/
Does this help you?
regards
Kees
05-16-2019 02:54 AM
Hi Kees,
Thanks you for your quickness!
I think it will be good, i've just to find how to create and use user-defined java procedures in Neo4j
Regards
Yann
05-16-2019 02:59 AM
05-16-2019 03:00 AM
Thanks you very much Kees!
Have a nice day
All the sessions of the conference are now available online