1.any2Enum Function
Converts an anytype value to the Name property value of an element in the target enum.
Syntax:
enum any2Enum(anytype object)
Return Value:
The value of the Name property for whichever element on the target enum has a Value property that matches the input parameter.
Remarks:
The object parameter can be of most data types, but useful data is only obtained by using a parameter of type str or int.
This input object parameter refers to the Value property of an individual element in the target enum.
Example:
NoYes myNoYes; // NoYes is an enum.
int i;
str s;
i = 0; // An int that will be converted.
myNoYes = any2Enum(i);
Global::info(strfmt("'%1' - is the output, from input of the %2 as
int.", myNoYes, i));
s = "1"; // A str that will be converted.
myNoYes = any2Enum(s);
Global::info(strfmt("'%1' - is the output, from input of the %2 as
str.", myNoYes, s));
OP: 'No' - is the output, from input of the 0 as int.
'Yes' - is the output, from input of the 1 as str.
2.any2Date Function:
Converts an anytype value to a date value.
Syntax: date any2Date(anytype object)
Note:-Object:The value to convert to a date.
Example:
date getdate;
str s;
int i
;
s="2012 2 12"; //yyyy mm dd
getdate=any2date(s);
{
info(strFmt("%1",getdate));
//OP:2/12/2012
}
i=40361;
getdate=any2date(i);
{
info(strFmt("%1",getdate));
//Op: 7/4/2010
}
3.any2Guid Function:
Converts the specified anytype object to a GUID object.
Syntax: guid any2Guid(anytype object)
4.any2Int Function :
Converts an anytype value to an int value.
Syntax: int any2Int(anytype object)
5.any2Int64 Function:
Converts an anytype object to an int64 object.
Example:
int Sint;
str s;
NoYes Ny;
real re;
;
s="55";
Sint=any2int(s); or Sint=any2int64(s);
info(strFmt("%1",s));//op:55
Ny=NoYes::Yes;
Sint=any2int(Ny);
info(strFmt("%1",Sint));//Op:1
re=5.99;
Sint=any2int(re);
info(strFmt("%1",Sint));//
Op:5
6.any2Real Function:
Converts an anytype value to a real value.
Syntax:
real any2Real(anytype object)
Example:
real Re;
str s;
int i;
NoYes ny;
;
s="5.66";
Re=any2real(s);
info(strFmt("%1",Re));//Op:5.66
i=99;
Re=any2real(i);
info(strFmt("%1",Re));Op:99.00
ny=NoYes::No;
Re=any2real(ny);
info(strFmt("%1",Re));
Op:0.00
7.any2Str Function:
Converts an anytype value to a str value
Syntax:
Str any2str(anytype object)
Example:
str mystring;
anytype a;
NoYes ny;
int i;
;
a="delhi64";
mystring=any2str(a);
info(strFmt("%1",mystring));//Op:delhi64
a=NoYes::No;
mystring=any2str(a);
info(strFmt("%1",mystring));
Op:0(because it is the value of specified enum element)
8.char2Num Function:
Converts a character in a string to the ASCII value of the character.
Syntax:
int char2Num(str text, int position)
Example:
int i;
str s;
;
s="shiva";
i=char2num(s,5);
info(strFmt("%1",i));
Op:97
9.date2Num Function:
Converts a date to an integer that corresponds to the number of days since 1 January, 1900.
Syntax: int date2Num(date _date)
_date:date to convert;
Example:
date d;
int i;
;
d=today();
i=date2num(d);
info(strFmt("%1",i));
or
i=date2num(29\04\2015);
info(strFmt("%1",i))
Op: 42121
Note: Retrives the number of days between from 1 January, 1900 and the specified date.
10.date2Str Function:
Converts the specified date to a string
Syntax: str date2Str(
date date,
int sequence,
int day,
int separator1,
int month,
int separator2,
int year
[, int flags = DateFlags::None])
Parameters
Parameter
|
Description
|
date
|
The date to convert.
|
sequence
|
A three digit number that indicates the sequence for the components of the date, 1 for day, 2 for month, and 3 for year.
|
day
|
A DateDay enumeration value that indicates the format for the day component of the date.
|
separator1
|
A DateSeparator enumeration value that indicates the separator to use between the first two components of the date.
|
month
|
A DateMonth enumeration value that indicates the format for the month component of the date.
|
separator2
|
A DateSeparator enumeration value that indicates the separator to use between the last two components of the date.
|
year
|
A DateYear enumeration value that indicates the format for the year component of the date.
|
flags
|
A DateFlags enumeration value that indicates whether the language settings on the local computer should be used to calculate the proper left-to-right or right-to-left sequence in the returned string.
|
Return Value
A string that represents the specified date.
Example:
date Todaydate=today();
str s;
;
s=date2str(Todaydate,123,DateDay::Digits2,DateSeparator::Slash,DateMonth::Digits2,DateSeparator
::Slash,DateYear::Digits4);
info("today is"+s);Op:29
or
//date Todaydate=today();
str s;
;
s=date2str(Today(),123,DateDay::Digits2,DateSeparator::Slash,DateMonth::Digits2,DateSeparator
::Slash,DateYear::Digits4);
info("today’s date is" +s);
Op: today’s date is 29/04/2015
11.datetime2Str Function:
Converts a utcdatetime value into a string.
Syntax: str datetime2Str(
utcdatetime datetime
[, int flags = DateFlags::None])
Example:
utcdatetime utc2 = 1959-06-17T15:44:33;
str s3;
;
s3 = datetime2Str( utc2 );
info( s3 );
Op: 4/29/2015 03:44:33 pm
12.formattedStr2Num:
Converts a semi-numeric string into a real number.
Syntax:real formattedstr2Num(str _text)
Example:
print formattedstr2Num("123.45");//Op:123.45
pause;
or
real r;
r=formattedstr2Num("123");
info(strFmt("%1",r));//Op:123.00
or
int i;
i=formattedstr2Num("123.01");
info(strFmt("%1",i));Op:123
or
print formattedstr2Num("356890");
pause;//Op:356,890.00
or
print formattedStr2num("12+1200");
pause;
Op:12,12.00
13.guid2Str Function:
Converts the specified GUID object to the equivalent string.
Syntax: str guid2String(guid _uuid)
Example:
guid _guid;
str stringGuid;
;
_guid = Global::guidFromString
("{12345678-1234-1234-1234-123456789abc}");
print strfmt("GUID is %1", _guid);
stringGuid = guid2str(_guid);
info("String GUID is " + stringGuid);
Op: String GUID is {12345678-1234-1234-1234-123456789ABC}
14.int2Str Function:
Converts an integer to the equivalent string.
Syntax:
str int2Str(int integer)
15.int642Str Function:
Converts the specified integer parameter to the equivalent text string.
Syntax: str int642Str(int64 integer)
Example:
str s;
int i=64;
;
s=int2str(i);
info(strFmt("%1",s));Op:64;
or
info ("This is int2Str, value is " + int2Str(intMax()));
info ("This is int642Str, value is " + int642Str(int64Max()));
Op: This is int2Str, value is 2147483647
This is int642Str, value is 9223372036854775807
16.str2Int Function:
Converts a string to the equivalent integer.
Syntax: int str2Int(str _text)
Example:
int i;
str s="65";
;
i=str2int(s);
info(strFmt("%1",s));
//Op:65
17.num2Char Function:
Converts an integer to the corresponding ASCII character.
Syntax: str num2Char(int figure)
Example:
str s;
s=num2char(35);
info(strFmt("%1",s));//Op:#
18.num2Date Function:
Retrieves the date that corresponds to the specified number of days after 01\01\1900.
Syntax:
date num2Date(int _days)
Example:
date s;
s=num2date(36356);
info(strFmt("%1",s));
OP: 7/17/1999
19.num2Str Function:
Converts a real number to a string.
Syntax: str num2Str(
real number,
int character,
int decimals,
int separator1,
int separator2)
Example:
real num=0.1234567891123456;
info(num2str(num,0,10,1,3));//OP: 0.1234567891
info(num2str(num,0,17,1,3));//OP: 0.12
20.str2Enum Function:
Retrieves the enum element whose localized Label property value matches the input string.
Syntax: enum str2Enum(enum _type, str _text)
Example:
BankAccountType bat;
str sEnumValueLabelLocalized;
int nInt;
// enum2str.
sEnumValueLabelLocalized = enum2str
(BankAccountType::SavingsAccount);
info("Localized friendly string: "
+ sEnumValueLabelLocalized);
// str2enum.
bat = str2Enum(bat, sEnumValueLabelLocalized);
nInt = bat;
info("nInt = " + int2str(nInt));
Op: Localized friendly string: Savings account
nInt = 1
21.str2Date Function:
Converts the specified string to a date value.
Syntax:
date str2Date(str _text, str _sequence)
No comments:
Post a Comment