ITTS:ITTS Scrip:Change Format

出自ITTS
於 2020年12月4日 (五) 14:02 由 Vincentcheng2116討論 | 貢獻 所做的修訂
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
跳至導覽 跳至搜尋

Change Format[編輯]

Online chm help Change_Format

Work with smart format, String process by special argument.

support other's DLL call,

DLL can sent original string and now format formula to ITTS. ITTS will process those and send back to DLL


for example:

Original string ="1234567890abcdWXYZ"

format formula =S([1][2][3][4][5][6][7][8][9][10]) Process result::"1234567890"

format formula =S([ALL]) Process result::"1234567890abcdWXYZ"

format formula =S([1..5]) Process result::"12345"

format formula =S([1..-1]) //from 1 until last 1 Process result::"12345"

format formula =S([1..-6]) //from 1 until last 6 Process result::"1234567890abc"

format formula =S([-6..-1]) //from last 6 until last 1 Process result::"cdWXYZ"

format formula =S([1][2][3][4][5]);S([1][2][3][4][5]) Process result::"12345;12345"

format formula =S([1][2][3][4][5];[1][2][3][4][5]) Process result::"12345;12345"

format formula =S([11][12][13][14]) Process result::"abcd"

format formula =U([11][12][13][14])// upper case Process result::"ABCD"

format formula =S([15][16][17][18]) Process result::"WXYZ"

format formula =L([15][16][17][18])//lower case Process result::"wxyz"

format formula =LEN([all])//length of string Process result::"18"


format formula =V10([1][2]) //decimal Process result::"12"

format formula =V16([1][2]) //hex Process result::"18"//1*16^1 +2*16^0

format formula =V2([1][2]) //binary Process result::"4" //1*2^1 +2*2^0

format formula =X1610([1][2]) //16 base to 10 base Process result::"18"

format formula =X1608([1][2]) //16 base to 8 base Process result::"22"

format formula =X1602([1][2]) //16 base to 2 base Process result::"00010010"

format formula =X1016([1][2]):4 //10 base to 16 base fill with 4 digit Process result::"000C"

format formula =A10([1][2][3]) //Change String to ASC Code No. 1=ASC 49 Process result::"495051"

format formula =A16([1][2][3]) //Change String to ASC Code No. 1=ASC =0x30 Process result::"313233"

format formula =C16([3][1]) //Change ASC Code No. to String = ASC code 0x31 ="1" Process result::"1"

format formula =C10([6][5][6][6][6][7]) //Change ASC Code No. to String = ASC code 65 ="A" Process result::"ABC"

format formula =CRC([1][2] [3][4]) // Calculate the CRC 16 bit format formula =CRC16([1][2] [3][4]) // Calculate the CRC 16 bit Process result::"0EC9"

format formula =CRC8([1][2] [3][4]) // Calculate the CRC 8 bit Process result::"57" CRC calculation describe in : FWS-762967-0000 page 19: 16 bit CRC page 21: 8 bit CRC

New CRC for all 8 and 16

format formula =CRC_8_FF_00_1D_1_1([all]) = CRC8([all])

                      |  |  | | +- reverse result bool
                      |  |  | +----Reverse_data Bool   
                      |  |  +-----Polynom
                      |  +------Final xor
                      +--------- ini value

format formula =CRC_16_FFFF_0000_1021_0_0([all]) =CRC16([all])

                      |     |    |   | +- reverse result bool
                      |     |    |   +----Reverse_data Bool   
                      |     |    +-----------Polynom   
                      |     +------Final xor
                      +--------- ini value

caption


format formula =CRC_16_FFFF_0000_1021_0_0([all]) (CRC16/CCITT)


format formula =LRC([1][2] [3][4]) // Calculate check sum checksum Process result: "BA"

LRC example


format formula =MD5_Str([1][2][3][4]) // Calculate MD5 of string you giving

 Process result: 81DC9BDB52D04DC20036DBD8313ED055

format formula =MD5_File(full_path_filename) // Calculate MD5 of file you giving

  • Example:
  • s:str=["c:\dll_list.txt"] = c:\dll_list.txt
  • ['&STR_VAR:s':MD5_File([all])] = D6EC13B6106DE6EB3CECA2DDAEE967E0

format formula =M2(#h[1][2],) // extract 2 character form original string, mask and repeat until string empty Process result::"#h12,#h34,#h56,#h78,#h90,#hab,#hcd,#hWX,#hYZ,"

Separator change 1: Original string ="123,456,789,0abc,dWXYZ" as T44([ALL]) ASC (44)= ',' then T44([ALL]) return '123;456;789;0abc;dWXYZ;'

Separator change 2: Original string ="123 456 789" as T32([ALL]) ASC (32)= ' ' then T32([ALL]) return '123;456;789;'

'R': remove specific character form result 123_456_789, R95([ALL]) ==> 123456789;

       This function is for converting the integer to the ASCII code
       such as R44([ALL])     ASC (44)= ','
       such as R32([ALL])     ASC (32)= ' '
       such as R95([ALL])     ASC (95)= '_'

Example:

       if [ALL]= '123,456,789,' then R44([ALL]) return '123456789;'
       if [ALL]= '123 456 789,' then R32([ALL]) return '123456789;'

Bit Select: Example: Original String: "AB" (10101011 )

S([2:3210][1:3210]) ==> "10111010" S([2:0123][1:3210]) ==> "11011010" S([2:10][1:32]) ==> "1110" X0216([2:3210][1:3210]) ==> "BA" X0210([2:3210][1:3210]) ==>186


['Keylist':S(['&var:i']['&var:j'])] ['Keylist':S([2]['&var:j'])] ['Keylist':S([2:3210]['&var:j'])] ['Keylist':S(['&var:j':3210])] ['Keylist':S(['&MACHINEID'])]


Example: a0,a1,a2 are the FieldName. ['&Str_var:MapTable':s(['a2']['a1']['a0'])]

Str_Var CryptoSelectString = ["S([151][152][154][155])"] Str_Var KBCryptoKey = ['KBDataBuffer':'&Str_Var:CryptoSelectString']

['&STR_VAR:SA':V10(['f2']['f1'])] ['&STR_VAR:S':X1610(['f3']['f2']['f1'])] ['Test3':s(['f3']['f2']['f1'])]

New smart format Since ITTS 3.1.1.27

  • FLOAT_TO_HEX // transfer float value to hex value // since ITTS 3.1.1.27
  • SINGLE_TO_HEX // transfer float value to hex value 8byte (same as flaot_to_Hex) // since ITTS 3.1.1.27
  • DOUBLE_TO_HEX // transfer float value to hex value 16byte (same as flaot_to_Hex) // since ITTS 3.1.1.27
  • HEX_TO_SINGLE // transfer hex value to float value 8byte // since ITTS 3.1.1.27
  • HEX_TO_DOUBLE // transfer hex value to float value 16byte // since ITTS 3.1.1.27
  • Example:

FLOAT_TO_HEX

 Original string ="1.234E18"
 format formula =SINGLE_TO_HEX([all])
 or 
 format formula =FLOAT_TO_HEX([all])
 Process result:"5D890064" 

DOUBLE_TO_HEX

 format formula =DOUBLE_TO_HEX([all])
 Process result:"43B1200C7644D500"

HEX_TO_SINGLE

 Original string ="5D890064"
 format formula =HEX_TO_SINGLE([all])
 Process result:"1.23400004179486E18"

HEX_TO_DOUBLE

 Original string ="43B1200C7644D500"
 format formula =HEX_TO_DOUBLE([all])
 Process result:"1.234E18"


if there is brace "{}" inside the process string please refer to Brace process


[ITTS_Scrip_Command]