aqConvert.StrToInt64 Method

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

The StrToInt64 method converts the string S, which represents an integer number in decimal notation, to a number.

Declaration

aqConvert.StrToInt64(S)

S [in]    Required    String    
Result Integer

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

S

Specifies the string to be converted to a number. If the source string does not represent a valid number, StrToInt64 raises an exception.

Result Value

The long integer value to which the specified string has been converted.

Remarks

The StrToInt64 method can convert strings of hexadecimal characters that are prefixed with the following symbols:

Your project's language Symbol
JavaScript, JScript, Python, C#Script and C++Script 0x
VBScript &H
DelphiScript $

Example

The code below demonstrates how you can convert strings to integer numbers.

JavaScript, JScript

function StringToIntNum()
{
  Log.Message(aqConvert.StrToInt64("153"));
  Log.Message(aqConvert.StrToInt64("9111111111111111111"));
  Log.Message(aqConvert.StrToInt64("0x123"));
}

/*
The routine produces the following output:
153
9111111111111111111
291
*/

Python

def StringToIntNum():
  Log.Message(aqConvert.StrToInt64("153"))
  Log.Message(aqConvert.StrToInt64("9111111111111111111"))
  Log.Message(aqConvert.StrToInt64("0x123"))

# The routine produces the following output:
# 153
# 9111111111111111111
# 291

VBScript

sub StringToIntNum
  Log.Message(aqConvert.StrToInt64("153"))
  Log.Message(aqConvert.StrToInt64("9111111111111111111"))
  Log.Message(aqConvert.StrToInt64("&H123"))
end sub

'The routine produces the following output:
'153
'9111111111111111111
'291

DelphiScript

procedure StringToIntNum;
begin 
  Log.Message(aqConvert.StrToInt64('153'));
  Log.Message(aqConvert.StrToInt64('9111111111111111111'));
  Log.Message(aqConvert.StrToInt64('$123'));
end;

{
The routine produces the following output:
153
9.111111111111111111E18
291
}

C++Script, C#Script

function StringToIntNum()
{
  Log["Message"](aqConvert["StrToInt64"]("153"));
  Log["Message"](aqConvert["StrToInt64"]("9111111111111111111"));
  Log["Message"](aqConvert["StrToInt64"]("0x123"));
}

/*
The routine produces the following output:

153
9111111111111111111
291
*/

See Also

Working With Numeric Values
aqConvert.IntToStr Method
aqConvert.FloatToStr Method
aqConvert.CurrencyToStr Method
aqString.Format Method

Highlight search results