What are some ways I can convert a string to a number?

51 Views Asked by At

I am trying to generate a Code 11 Barcode, from strings, but I can't quite figure out a formulaic way to do this.

I have a list of products and product names, and the barcode readers require numbers. I also want to ensure that the digit generated doesn't clash with any barcode digits for any products that the store currently has in inventory -- that's why I haven't done something "simple" like 00000001, etc.

Say I have a list of product names like this:

  • Eye Chart
  • John Wago
  • Very Long Product Name 1
  • Extra Very Long Product Name 20

Ideally I would love to be able to generate an 11-digit code that fits this Code 11 Barcode Standard.

P.S. I don't know how to categorize this post, so can someone more knowledgeable than I properly tag this question please.