Skip to main content
Skip table of contents

ID card transformation commands

  • ltrim(number of characters) – Remove the first X characters from the left.
    ltrim(2): 123456 —> 3456

  • rtrim(number of characters) – Remove the first X characters from the right (the last X characters).
    rtrim(2): 123456 —> 1234

  • prepend(character string) – Add the string in front of the card number.
    prepend(AB): 123456 —> AB123456

  • append(character string) – Add the string behind the card number.
    append(AB): 123456 —> 123456AB

  • left(number of characters) – Select the first X characters from the left (and remove the rest).
    left(2): 123456 —>12

  • right(number of characters) – Select the first X characters from the right.
    right(2):123456 —> 56

  • mid(number of characters, number of characters) – Remove X characters from the left, remove Y characters from the right and leave the characters in the middle.
    mid(2,2): 123456 —> 34

  • lpad(number of positions, symbol) – Complete the string to the length specified by the number of positions parameter by adding the value of the symbol parameter to the left (in front of the card number).
    lpad(12,0): 123456 —> 000000123456

  • hex2dec() – Transform the card number from hexadecimal mode to decimal mode.
    hex2dec(): 1000AB —> 1048747

  • dec2hex() – Transform the card number from decimal mode to hexadecimal mode.
    dec2hex(): 1048747 —>1000AB

  • hex2bin – Transform the card number from hexadecimal mode to binary mode.
    hex2bin(): 1000AB —> 100000000000010101011

  • bin2hex – Transform the card number from binary mode to hexadecimal mode.
    bin2hex(): 100000000000010101011 —> 1000AB

  • dec2bin – Transform the card number from decimal mode to binary mode.
    dec2bin(): 100023 —> 11000011010110111

  • bin2dec – Transform the card number from binary mode to decimal mode.
    bin2dec(): 11000011010110111 —> 100023

  • reverse() – Reverse the byte sequence, i.e. take all the characters by two and reverse the order of the pairs. (The last pair goes first, the second last goes second, etc.)
    reverse(): 1234AB —> AB3412

  • reverseString() – Reverse the character sequence. (The last character goes first, the second last goes second, etc.)
    reverseString(): 1234AB —> BA4321

  • reverseNibbleBits() – Convert each character from hexadecimal mode to binary mode, reverse the character sequence of each quadruple and convert the result back to hexadecimal mode.
    reverseNibbleBits(): 10AB —> 0001 0000 1010 1011 —> 1000 0000 0101 1101 —> 805D

  • upper() – Converts the string to upper case.
    upper(): Abcd —> ABCD

  • plugin(reference) – Calls a card transformation plugin with the given reference. This option enables using custom PHP scripts for the transformation. For more information about this option, contact MyQ support.

  • asciiCode2ascii – Converts ASCII characters encoded as hex-digits to ASCII characters.
    asciiCode2ascii(): 414F —> AO

  • "string 1" + "string 2" – Merges the strings in front of and behind the + command.
    "string 1":

    • Either the initial card number (if there are no commands preceding the + symbol),

    • or the result of the last command before the + symbol (if there are no + commands preceding the + symbol),

    • or the result of the previous + command.
      "string 2":

    • Either the initial card number (if there are no commands behind the + symbol or if the next command is another + command),

    • or the result of the last command of the transformation (if there are no + commands behind the + symbol),

    • or the result of the last command before another + command.

ID card transformation example:

Card number: 10AB

Card code transformation: hex2bin();lpad(16,0);reverseString();ltrim(8);reverseString();bin2hex() + ltrim(4);lpad(4,10AB)

Result: 1010AB

Transformation process:
("10AB" —>"1 0000 1010 1011" —> "0001 0000 1010 1011" —> "1101 0101 0000 1000" —> "0000 1000" —> "0001 0000" —> "10") + ("10AB"" —> "" —> "10AB") ==> "1010AB"

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.