Method to convert memory from string to long