function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hi,
anyone have the code for validate IBAN, SWIFT and EAN-13 ? or any website with the code ?
Thanks for all
Saludos !!
I started creating the functions for validate IBAN, SWIFT and EAN-13, this function validate SWIFT
public Boolean validateSWIFT(String swift){ System.debug('SWIFT: '+ swift); String patron = '^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$'; Pattern myPattern = Pattern.compile(patron); Matcher myMatcher = myPattern.matcher(swift); return myMatcher.matches(); }
Coming soon function validate EAN
this code validate EAN code
public Boolean validateEAN(String ean){ String validChars = '0123456789'; String digit; String originalCheck; Integer even; Integer odd; Integer total; Integer originalCheck; for(Integer i = 0; i < validChars.length(); i++){ digit = ean.substring(i, i+1); if(!(validChars.contains(digit))) return false; } /*Add five 0 the code has only 8 digits*/ if(ean.length() == 8) ean = '00000'+ ean; else if(ean.length() != 13) /*Chack 13 digits otherwise*/ return false; /*Ger the check number*/ originalCheck = ean.substring(ean.length()-1); ean = ean.substring(0, ean.length()-1); /*Add even number together*/ even = Integer.valueOf(ean.substring(1,2)) + Integer.valueOf(ean.substring(3,4)) + Integer.valueOf(ean.substring(5,6)) + Integer.valueOf(ean.substring(7,8)) + Integer.valueOf(ean.substring(9,10)) + Integer.valueOf(ean.substring(11,12)); even = even * 3; /*Add odd numbers together*/ odd = Integer.valueOf(ean.substring(0,1)) + Integer.valueOf(ean.substring(2,3)) + Integer.valueOf(ean.substring(4,5)) + Integer.valueOf(ean.substring(6,7)) + Integer.valueOf(ean.substring(8,9)) + Integer.valueOf(ean.substring(10,11)); /*Add two totals together*/ total = even + odd; /*Calculate the checksum*/ checksum = math.mod(total,10); /*If result is not 0 then take away 10*/ if(checksum != 0) checksum = 10 - checksum; /*Return the result*/ if(checksum != Integer.valueOf(originalCheck)) return false; return true; }
Only one more :D
Hi,
I started creating the functions for validate IBAN, SWIFT and EAN-13, this function validate SWIFT
Coming soon function validate EAN
Saludos !!
Hi,
this code validate EAN code
Only one more :D
http://stackoverflow.com/questions/10143547/how-do-i-validate-a-upc-or-ean-code
Check this:http://www.keepdynamic.com/dotnet-barcode/barcode/ean-13.shtml