Tuesday, August 24, 2004

substring evilness... i wanted to produce serial numbers of uniform length for the index (5 characters)... this is my lame solution...

the inner loop:


int serialIndex = 100000 + index;
String serial = serialPrefix + String.valueOf(serialIndex).substring(1);


this produces padded serial numbesr e.g. 00001, 03450. certainly not optimal... but will do for now ;)

this obviously limits the number of entities to 99999... converting to hex would increase the limit a bit, but the printer guys argued its too much of a hassle to check the correct sequences since its still done manually... ok, so be it...

No comments: