Tải bản đầy đủ (.pdf) (6 trang)

AutoI Technology Curriculum Book part 110 potx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (15.51 KB, 6 trang )

Related
Int, String
Example

$w = Number(1+2+10) ;returns 13
$x = Number("3.14") ;returns 3.14
$y = Number("24/7") ;returns 24
$z = Number("tmp3") ;returns 0




Function Reference
Ptr
Converts an expression into a pointer variant.
Ptr ( expression )
Parameters
expression An expression to convert into a pointer variant.

Return Value
Returns the pointer representation of the expression.
Remarks
None.
Related
HWnd, Int, IsPtr, String, Number
Example






Function Reference
String
Returns the string representation of an expression.
String ( expression )
Parameters
expression An expression to convert into a string.

Return Value
Returns a string.
Remarks
Maximum string length is 2147483647 characters (but keep in mind that no line in
an AutoIt script can exceed 4095 characters.)
Related
Int, Number, IsString, Chr
Example

$var = String(10)
;$var is the string "10"




Function Reference
StringToBinary
Converts a string into binary data.
StringToBinary ( expression [, flag] )
Parameters
expression An expression to convert into binary data.
flag
[optional] Changes how the string is stored as binary:

flag = 1 (default), binary data is ANSI
flag = 2, binary data is UTF16 Little Endian
flag = 3, binary data is UTF16 Big Endian
flag = 4, binary data is UTF8

Return Value
Returns a binary variant.
Remarks
None.
Related
Binary, BinaryToString, IsBinary, String
Example

; Binary ANSI to String
$buffer = StringToBinary("Hello - ä½ å¥½")
MsgBox(4096, "String() representation" , $buffer)
$buffer = BinaryToString($buffer)
MsgBox(4096, "BinaryToString() ANSI representation" , $buffer)

; Binary UTF16-LE to String
$buffer = StringToBinary("Hello - ä½ å¥½", 2)
MsgBox(4096, "String() representation" , $buffer)
$buffer = BinaryToString($buffer, 2)
MsgBox(4096, "BinaryToString() UTF16-LE representation" , $buffer)

; Binary UTF16-BE to String
$buffer = StringToBinary("Hello - ä½ å¥½", 3)
MsgBox(4096, "String() representation" , $buffer)
$buffer = BinaryToString($buffer, 3)
MsgBox(4096, "BinaryToString() UTF16-BE representation" , $buffer)


; Binary UTF8 to String
$buffer = StringToBinary("Hello - ä½ å¥½", 4)
MsgBox(4096, "String() representation" , $buffer)
$buffer = BinaryToString($buffer, 4)
MsgBox(4096, "BinaryToString() UTF8 representation" , $buffer)




Function Reference
UBound
Returns the size of array dimensions.
UBound ( Array [, Dimension] )
Parameters
Array The array variable which is being queried.
Dimension

[optional] Which dimension of a multi-
dimensioned array to report the
size of. Default is 1, which is the first dimension. If this parameter is
0, the number of subscripts in the array is returned.

Return Value
Success:

Returns the size of the array dimension.
Failure:

Returns 0 and sets @error:

1 = Array given is not an array.
2 = Array dimension is invalid.

Remarks
Remember that the value returned by UBound is one greater than the index of an
array's last element!
Related
Dim
Example

Dim $myArray[10][20] ;element 0,0 to 9,19
$rows = UBound($myArray)
$cols = UBound($myArray, 2)
$dims = UBound($myArray, 0)

MsgBox(0, "The " & $dims & "-dimensional array has", _
$rows & " rows, " & $cols & " columns")

;Display $myArray's contents
$output = ""
For $r = 0 to UBound($myArray,1) - 1
$output = $output & @LF
For $c = 0 to UBound($myArray,2) - 1
$output = $output & $myArray[$r][$c] & " "
Next

×