W
Wendy S
I'm sorting JPG files into directories based on an IPTC field. I need a way
to create a reasonably short directory name based on a longer (up to 64
chars) String. For example, I might have 100 images, each having one of
these three IPTC Headlines:
Mary Smith | Zorro | Some Event
John Brown | Patrick | Some Event
Alice Jones | Jack | Some Event
I need to generate three short strings that I can use for directory names
that will be the same every time a certain String is processed. I do NOT
need to be able to decode the original value from the shortened one. I only
care that I get the same directory name for the same long string every time
I "compress" it.
After some searching around, I realized that String.hashCode() does
_exactly_ what I'm asking for.
However, vanity requires (or at least wishes) that the directory name be a
little "prettier" and alphanumeric. Is there anything I can do with an
integer like 1263925117 to get something like 4xr52z (and still be
reasonably sure I won't get duplicates, even when the second half of all of
the Strings is likely to be the same)?
Or does anyone know another way to compress the original String into
something shorter?
(If anyone comes upon this later looking for a Java API to read IPTC or EXIF
data from images, look here: http://www.drewnoakes.com/code/exif/ )
Thanks for any ideas,
to create a reasonably short directory name based on a longer (up to 64
chars) String. For example, I might have 100 images, each having one of
these three IPTC Headlines:
Mary Smith | Zorro | Some Event
John Brown | Patrick | Some Event
Alice Jones | Jack | Some Event
I need to generate three short strings that I can use for directory names
that will be the same every time a certain String is processed. I do NOT
need to be able to decode the original value from the shortened one. I only
care that I get the same directory name for the same long string every time
I "compress" it.
After some searching around, I realized that String.hashCode() does
_exactly_ what I'm asking for.
However, vanity requires (or at least wishes) that the directory name be a
little "prettier" and alphanumeric. Is there anything I can do with an
integer like 1263925117 to get something like 4xr52z (and still be
reasonably sure I won't get duplicates, even when the second half of all of
the Strings is likely to be the same)?
Or does anyone know another way to compress the original String into
something shorter?
(If anyone comes upon this later looking for a Java API to read IPTC or EXIF
data from images, look here: http://www.drewnoakes.com/code/exif/ )
Thanks for any ideas,