SlideShare a Scribd company logo
Ring Documentation, Release 1.6
29.8 EpochTime() Function
Syntax:
EpochTime( cDate, cTime ) ---> Epoch Seconds
Example:
###-------------------------------------------------------------
# EpochTime()
# Example --- EpochSec = EpochTime( Date(), Time() )
# Call Format: EpochSec = EpochTime( "15/07/2016", "10:15:30" )
# EpochSec = 1468577730
#---------------------------------------------------------------
Func EpochTime(Date, Time)
arrayDate = split(Date, "/")
arrayTime = split(Time, ":")
Year = arrayDate[3] ; Month = arrayDate[2] ; Day = arrayDate[1]
Hour = arrayTime[1] ; Minute = arrayTime[2] ; Second = arrayTime[3]
cDate1 = Day +"/"+ Month +"/"+ Year
cDate2 = "01/01/" + Year
DayOfYear = DiffDays( cDate1, cDate2)
### Formula
tm_sec = Second * 1
tm_min = Minute * 60
tm_hour = Hour * 3600
tm_yday = DayOfYear * 86400
tm_year = Year - 1900
tm_year1 = ( tm_year - 70) * 31536000
tm_year2 = ( floor(( tm_year - 69) / 4 )) * 86400
tm_year3 = ( floor(( tm_year - 1) / 100 )) * 86400
tm_year4 = ( floor(( tm_year + 299) / 400 )) * 86400
### Result
EpochSec = tm_sec + tm_min + tm_hour + tm_yday + tm_year1 + tm_year2 - tm_year3 + tm_year4
return EpochSec
29.8. EpochTime() Function 223
CHAPTER
THIRTY
CHECK DATA TYPE AND CONVERSION
In this chapter we are going to learn about the functions that can be used for
• Checking Data Type
• Checking Character
• Conversion
30.1 Check Data Type
The next functions can be used to check the data type
• isstring()
• isnumber()
• islist()
• type()
• isnull()
30.2 IsString() Function
Using the IsString() function we can know if the value is a string or not
Syntax:
IsString(value) ---> 1 if the value is a string or 0 if not
Example:
see isstring(5) + nl + # print 0
isstring("hello") + nl # print 1
30.3 IsNumber() Function
Using the IsNumber() function we can know if the value is a number or not
Syntax:
224
Ring Documentation, Release 1.6
IsNumber(value) ---> 1 if the value is a number or 0 if not
Example:
see isnumber(5) + nl + # print 1
isnumber("hello") + nl # print 0
30.4 IsList() Function
Using the IsList() function we can know if the value is a list or not
Syntax:
IsList(value) ---> 1 if the value is a list or 0 if not
Example:
see islist(5) + nl + # print 0
islist("hello") + nl + # print 0
islist([1,3,5]) # print 1
30.5 Type() Function
We can know the type of a value using the Type() Function.
Syntax:
Type(value) ---> The Type as String
Example:
see Type(5) + nl + # print NUMBER
Type("hello") + nl + # print STRING
Type([1,3,5]) # print LIST
30.6 IsNULL() Function
We can check the value to know if it’s null or not using the IsNULL() function
Syntax:
IsNULL(value) ---> 1 if the value is NULL or 0 if not
Example:
see isnull(5) + nl + # print 0
isnull("hello") + nl + # print 0
isnull([1,3,5]) + nl + # print 0
isnull("") + nl + # print 1
isnull("NULL") # print 1
30.4. IsList() Function 225
Ring Documentation, Release 1.6
30.7 Check Character
The next functions can be used to check character
• isalnum()
• isalpha()
• iscntrl()
• isdigit()
• isgraph()
• islower()
• isprint()
• ispunct()
• isspace()
• isupper()
• isxdigit()
30.8 IsAlNum() Function
We can test a character or a string using the IsAlNum() Function
Syntax:
IsAlNum(value) ---> 1 if the value is digit/letter or 0 if not
Example:
see isalnum("Hello") + nl + # print 1
isalnum("123456") + nl + # print 1
isalnum("ABCabc123") + nl + # print 1
isalnum("How are you") # print 0 because of spaces
30.9 IsAlpha() Function
We can test a character or a string using the IsAlpha() Function
Syntax:
IsAlpha(value) ---> 1 if the value is a letter or 0 if not
Example:
see isalpha("Hello") + nl + # print 1
isalpha("123456") + nl + # print 0
isalpha("ABCabc123") + nl + # print 0
isalpha("How are you") # print 0
30.7. Check Character 226
Ring Documentation, Release 1.6
30.10 IsCntrl() Function
We can test a character or a string using the IsCntrl() Function
Syntax:
IsCntrl(value) ---> 1 if the value is a control character (no printing position) or 0 if not
Example:
See iscntrl("hello") + nl + # print 0
iscntrl(nl) # print 1
30.11 IsDigit() Function
We can test a character or a string using the IsDigit() Function
Syntax:
IsDigit(value) ---> 1 if the value is a digit or 0 if not
Example:
see isdigit("0123456789") + nl + # print 1
isdigit("0123a") # print 0
30.12 IsGraph() Function
We can test a character or a string using the IsGraph() Function
Syntax:
IsGraph(value) ---> 1 if the value can be printed (Except space) or 0 if not
Example:
see isgraph("abcdef") + nl + # print 1
isgraph("abc def") # print 0
30.13 IsLower() Function
We can test a character or a string using the IsLower() Function
Syntax:
IsLower(value) ---> 1 if the value is lowercase letter or 0 if not
Example:
see islower("abcDEF") + nl + # print 0
islower("ghi") # print 1
30.10. IsCntrl() Function 227
Ring Documentation, Release 1.6
30.14 IsPrint() Function
We can test a character or a string using the IsPrint() Function
Syntax:
IsPrint(value) ---> 1 if the value occupies a printing position or 0 if not
Example:
see isprint("Hello") + nl + # print 1
isprint("Nice to see you") + nl + # print 1
isprint(nl) # print 0
30.15 IsPunct() Function
We can test a character or a string using the IsPunct() Function
Syntax:
IsPunct(value) ---> 1 if the value is a punctuation character or 0 if not
Example:
see ispunct("hello") + nl + # print 0
ispunct(",") # print 1
30.16 IsSpace() Function
We can test a character or a string using the IsSpace() Function
Syntax:
IsSpace(value) ---> 1 if the value is a white-space or 0 if not
Example:
see isspace(" ") + nl + # print 1
isspace("test") # print 0
30.17 IsUpper() Function
We can test a character or a string using the IsUpper() Function
Syntax:
IsUpper(value) ---> 1 if the value is an uppercase alphabetic letter or 0 if not
Example:
see isupper("welcome") + nl + # print 0
isupper("WELCOME") # print 1
30.14. IsPrint() Function 228
Ring Documentation, Release 1.6
30.18 IsXdigit() Function
We can test a character or a string using the IsXdigit() Function
Syntax:
IsXdigit(value) ---> 1 if the value is a hexdecimal digit character or 0 if not
Example:
see isxdigit("0123456789abcdef") + nl + # print 1
isxdigit("123z") # print 0
30.19 Conversion
The next functions can be used for conversion
• number()
• string()
• ascii()
• char()
• hex()
• dec()
• str2hex()
• hex2str()
30.20 Number() Function
We can convert strings to numbers using the Number() function or the + operator.
Syntax:
Number(string) ---> Number
0 + string ---> Number
Example:
see number("5") + 5 + nl # print 10
see 0 + "10" + 2 # print 12
30.21 String() Function
We can convert numbers to strings using the String() function or the + operator.
Syntax:
String(number) ---> String
"" + number ---> String
30.18. IsXdigit() Function 229
Ring Documentation, Release 1.6
Example:
see string(5) + 5 + nl # print 55
see "" + 10 + 2 # print 102
30.22 Ascii() Function
We can get the ASCII code for a letter using the Ascii() function
Syntax:
Ascii(character) ---> ASCII Code
Example:
See ascii("m") + nl + # print 109
ascii("M") # print 77
30.23 Char() Function
We can convert the ASCII code to character using the Char() function.
Syntax:
Char(ASCII Code) ---> character
Example:
See char(109) + nl + # print m
char(77) # print M
30.24 Hex() Function
We can convert decimal to hexadecimal using the Hex() function.
Syntax:
Hex(decimal) ---> hexadecimal
Example:
See hex(10) + nl + # print a
hex(200) # print c8
30.25 Dec() Function
We can convert hexadecimal to decimal using the Dec() function
Syntax:
Dec(hexadecimal) ---> decimal
30.22. Ascii() Function 230
Ring Documentation, Release 1.6
Example:
See dec("a") + nl + # print 10
dec("c8") # print 200
30.26 Str2hex() Function
We can convert string characters to hexadecimal characters using the Str2hex() function.
Syntax:
Str2hex(string) ---> hexadecimal string
Example:
See str2hex("hello") # print 68656c6c6f
30.27 Hex2str() Function
We can convert hexadecimal characters to string using the Hex2str() function
Syntax:
Hex2Str(Hexadecimal string) ---> string
Example:
See hex2str("68656c6c6f") # print hello
30.26. Str2hex() Function 231
CHAPTER
THIRTYONE
MATHEMATICAL FUNCTIONS
In this chapter we are going to learn about the mathematical functions
31.1 List of functions
The Ring programming language comes with the next mathematical functions
Function Description
sin(x) Returns the sine of an angle of x radians
cos(x) Returns the cosine of an angle of x radians
tan(x) Returns the tangent of an angle of x radians
asin(x) Returns the principal value of the arc sine of x, expressed in radians
acos(x) Returns the principal value of the arc cosine of x, expressed in radians
atan(x) Returns the principal value of the arc tangent of x, expressed in radians
atan2(y,x) Returns the principal arc tangent of y/x, in the interval [-pi,+pi] radians
sinh(x) Returns the hyperbolic sine of x radians
cosh(x) Returns the hyperbolic cosine of x radians
tanh(x) Returns the hyperbolic tangent of x radians
exp(x) Returns the value of e raised to the xth power
log(x) Returns the natural logarithm of x
log10(x) Returns the common logarithm (base-10 logarithm) of x
ceil(x) Returns the smallest integer value greater than or equal to x
floor(x) Returns the largest integer value less than or equal to x
fabs(x) Returns the absolute value of x.
pow(x,y) Returns x raised to the power of y
sqrt(x) Returns the square root of x
random(x) Returns a random number in the range [0,x]
unsigned(n,n,c) Perform operation using unsigned numbers
decimals(n) Determine the decimals digits after the point in float/double numbers
31.2 Example
See "Mathematical Functions" + nl
See "Sin(0) = " + sin(0) + nl
See "Sin(90) radians = " + sin(90) + nl
See "Sin(90) degree = " + sin(90*3.14/180) + nl
See "Cos(0) = " + cos(0) + nl
See "Cos(90) radians = " + cos(90) + nl
232

More Related Content

What's hot (20)

PDF
The Ring programming language version 1.7 book - Part 26 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 23 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 23 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 14 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 21 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 24 of 181
Mahmoud Samir Fayed
 
PPTX
Print input-presentation
Martin McBride
 
PDF
The Ring programming language version 1.3 book - Part 15 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 22 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 23 of 180
Mahmoud Samir Fayed
 
KEY
関数潮流(Function Tendency)
riue
 
PDF
Stanfy MadCode Meetup #9: Functional Programming 101 with Swift
Stanfy
 
PDF
The Ring programming language version 1.3 book - Part 32 of 88
Mahmoud Samir Fayed
 
PDF
Артём Акуляков - F# for Data Analysis
SpbDotNet Community
 
PDF
The Ring programming language version 1.5.3 book - Part 22 of 184
Mahmoud Samir Fayed
 
PDF
Implementing virtual machines in go & c 2018 redux
Eleanor McHugh
 
PPTX
Millionways
Brian Lonsdorf
 
PDF
The Ring programming language version 1.3 book - Part 14 of 88
Mahmoud Samir Fayed
 
PPTX
Oh Composable World!
Brian Lonsdorf
 
PDF
Effector: we need to go deeper
Victor Didenko
 
The Ring programming language version 1.7 book - Part 26 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 23 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 23 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 14 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 21 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 24 of 181
Mahmoud Samir Fayed
 
Print input-presentation
Martin McBride
 
The Ring programming language version 1.3 book - Part 15 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 22 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 23 of 180
Mahmoud Samir Fayed
 
関数潮流(Function Tendency)
riue
 
Stanfy MadCode Meetup #9: Functional Programming 101 with Swift
Stanfy
 
The Ring programming language version 1.3 book - Part 32 of 88
Mahmoud Samir Fayed
 
Артём Акуляков - F# for Data Analysis
SpbDotNet Community
 
The Ring programming language version 1.5.3 book - Part 22 of 184
Mahmoud Samir Fayed
 
Implementing virtual machines in go & c 2018 redux
Eleanor McHugh
 
Millionways
Brian Lonsdorf
 
The Ring programming language version 1.3 book - Part 14 of 88
Mahmoud Samir Fayed
 
Oh Composable World!
Brian Lonsdorf
 
Effector: we need to go deeper
Victor Didenko
 

Similar to The Ring programming language version 1.6 book - Part 26 of 189 (20)

PDF
The Ring programming language version 1.10 book - Part 32 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 13 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4.1 book - Part 6 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 28 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 36 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 37 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 35 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 37 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 32 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 16 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 38 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 34 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 44 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 39 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 26 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 23 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 39 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 36 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 35 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 33 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 32 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 13 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 6 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 28 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 36 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 37 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 35 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 37 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 32 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 16 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 38 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 34 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 44 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 39 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 26 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 23 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 39 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 36 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 35 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 33 of 181
Mahmoud Samir Fayed
 
Ad

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
Ad

Recently uploaded (20)

PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 

The Ring programming language version 1.6 book - Part 26 of 189

  • 1. Ring Documentation, Release 1.6 29.8 EpochTime() Function Syntax: EpochTime( cDate, cTime ) ---> Epoch Seconds Example: ###------------------------------------------------------------- # EpochTime() # Example --- EpochSec = EpochTime( Date(), Time() ) # Call Format: EpochSec = EpochTime( "15/07/2016", "10:15:30" ) # EpochSec = 1468577730 #--------------------------------------------------------------- Func EpochTime(Date, Time) arrayDate = split(Date, "/") arrayTime = split(Time, ":") Year = arrayDate[3] ; Month = arrayDate[2] ; Day = arrayDate[1] Hour = arrayTime[1] ; Minute = arrayTime[2] ; Second = arrayTime[3] cDate1 = Day +"/"+ Month +"/"+ Year cDate2 = "01/01/" + Year DayOfYear = DiffDays( cDate1, cDate2) ### Formula tm_sec = Second * 1 tm_min = Minute * 60 tm_hour = Hour * 3600 tm_yday = DayOfYear * 86400 tm_year = Year - 1900 tm_year1 = ( tm_year - 70) * 31536000 tm_year2 = ( floor(( tm_year - 69) / 4 )) * 86400 tm_year3 = ( floor(( tm_year - 1) / 100 )) * 86400 tm_year4 = ( floor(( tm_year + 299) / 400 )) * 86400 ### Result EpochSec = tm_sec + tm_min + tm_hour + tm_yday + tm_year1 + tm_year2 - tm_year3 + tm_year4 return EpochSec 29.8. EpochTime() Function 223
  • 2. CHAPTER THIRTY CHECK DATA TYPE AND CONVERSION In this chapter we are going to learn about the functions that can be used for • Checking Data Type • Checking Character • Conversion 30.1 Check Data Type The next functions can be used to check the data type • isstring() • isnumber() • islist() • type() • isnull() 30.2 IsString() Function Using the IsString() function we can know if the value is a string or not Syntax: IsString(value) ---> 1 if the value is a string or 0 if not Example: see isstring(5) + nl + # print 0 isstring("hello") + nl # print 1 30.3 IsNumber() Function Using the IsNumber() function we can know if the value is a number or not Syntax: 224
  • 3. Ring Documentation, Release 1.6 IsNumber(value) ---> 1 if the value is a number or 0 if not Example: see isnumber(5) + nl + # print 1 isnumber("hello") + nl # print 0 30.4 IsList() Function Using the IsList() function we can know if the value is a list or not Syntax: IsList(value) ---> 1 if the value is a list or 0 if not Example: see islist(5) + nl + # print 0 islist("hello") + nl + # print 0 islist([1,3,5]) # print 1 30.5 Type() Function We can know the type of a value using the Type() Function. Syntax: Type(value) ---> The Type as String Example: see Type(5) + nl + # print NUMBER Type("hello") + nl + # print STRING Type([1,3,5]) # print LIST 30.6 IsNULL() Function We can check the value to know if it’s null or not using the IsNULL() function Syntax: IsNULL(value) ---> 1 if the value is NULL or 0 if not Example: see isnull(5) + nl + # print 0 isnull("hello") + nl + # print 0 isnull([1,3,5]) + nl + # print 0 isnull("") + nl + # print 1 isnull("NULL") # print 1 30.4. IsList() Function 225
  • 4. Ring Documentation, Release 1.6 30.7 Check Character The next functions can be used to check character • isalnum() • isalpha() • iscntrl() • isdigit() • isgraph() • islower() • isprint() • ispunct() • isspace() • isupper() • isxdigit() 30.8 IsAlNum() Function We can test a character or a string using the IsAlNum() Function Syntax: IsAlNum(value) ---> 1 if the value is digit/letter or 0 if not Example: see isalnum("Hello") + nl + # print 1 isalnum("123456") + nl + # print 1 isalnum("ABCabc123") + nl + # print 1 isalnum("How are you") # print 0 because of spaces 30.9 IsAlpha() Function We can test a character or a string using the IsAlpha() Function Syntax: IsAlpha(value) ---> 1 if the value is a letter or 0 if not Example: see isalpha("Hello") + nl + # print 1 isalpha("123456") + nl + # print 0 isalpha("ABCabc123") + nl + # print 0 isalpha("How are you") # print 0 30.7. Check Character 226
  • 5. Ring Documentation, Release 1.6 30.10 IsCntrl() Function We can test a character or a string using the IsCntrl() Function Syntax: IsCntrl(value) ---> 1 if the value is a control character (no printing position) or 0 if not Example: See iscntrl("hello") + nl + # print 0 iscntrl(nl) # print 1 30.11 IsDigit() Function We can test a character or a string using the IsDigit() Function Syntax: IsDigit(value) ---> 1 if the value is a digit or 0 if not Example: see isdigit("0123456789") + nl + # print 1 isdigit("0123a") # print 0 30.12 IsGraph() Function We can test a character or a string using the IsGraph() Function Syntax: IsGraph(value) ---> 1 if the value can be printed (Except space) or 0 if not Example: see isgraph("abcdef") + nl + # print 1 isgraph("abc def") # print 0 30.13 IsLower() Function We can test a character or a string using the IsLower() Function Syntax: IsLower(value) ---> 1 if the value is lowercase letter or 0 if not Example: see islower("abcDEF") + nl + # print 0 islower("ghi") # print 1 30.10. IsCntrl() Function 227
  • 6. Ring Documentation, Release 1.6 30.14 IsPrint() Function We can test a character or a string using the IsPrint() Function Syntax: IsPrint(value) ---> 1 if the value occupies a printing position or 0 if not Example: see isprint("Hello") + nl + # print 1 isprint("Nice to see you") + nl + # print 1 isprint(nl) # print 0 30.15 IsPunct() Function We can test a character or a string using the IsPunct() Function Syntax: IsPunct(value) ---> 1 if the value is a punctuation character or 0 if not Example: see ispunct("hello") + nl + # print 0 ispunct(",") # print 1 30.16 IsSpace() Function We can test a character or a string using the IsSpace() Function Syntax: IsSpace(value) ---> 1 if the value is a white-space or 0 if not Example: see isspace(" ") + nl + # print 1 isspace("test") # print 0 30.17 IsUpper() Function We can test a character or a string using the IsUpper() Function Syntax: IsUpper(value) ---> 1 if the value is an uppercase alphabetic letter or 0 if not Example: see isupper("welcome") + nl + # print 0 isupper("WELCOME") # print 1 30.14. IsPrint() Function 228
  • 7. Ring Documentation, Release 1.6 30.18 IsXdigit() Function We can test a character or a string using the IsXdigit() Function Syntax: IsXdigit(value) ---> 1 if the value is a hexdecimal digit character or 0 if not Example: see isxdigit("0123456789abcdef") + nl + # print 1 isxdigit("123z") # print 0 30.19 Conversion The next functions can be used for conversion • number() • string() • ascii() • char() • hex() • dec() • str2hex() • hex2str() 30.20 Number() Function We can convert strings to numbers using the Number() function or the + operator. Syntax: Number(string) ---> Number 0 + string ---> Number Example: see number("5") + 5 + nl # print 10 see 0 + "10" + 2 # print 12 30.21 String() Function We can convert numbers to strings using the String() function or the + operator. Syntax: String(number) ---> String "" + number ---> String 30.18. IsXdigit() Function 229
  • 8. Ring Documentation, Release 1.6 Example: see string(5) + 5 + nl # print 55 see "" + 10 + 2 # print 102 30.22 Ascii() Function We can get the ASCII code for a letter using the Ascii() function Syntax: Ascii(character) ---> ASCII Code Example: See ascii("m") + nl + # print 109 ascii("M") # print 77 30.23 Char() Function We can convert the ASCII code to character using the Char() function. Syntax: Char(ASCII Code) ---> character Example: See char(109) + nl + # print m char(77) # print M 30.24 Hex() Function We can convert decimal to hexadecimal using the Hex() function. Syntax: Hex(decimal) ---> hexadecimal Example: See hex(10) + nl + # print a hex(200) # print c8 30.25 Dec() Function We can convert hexadecimal to decimal using the Dec() function Syntax: Dec(hexadecimal) ---> decimal 30.22. Ascii() Function 230
  • 9. Ring Documentation, Release 1.6 Example: See dec("a") + nl + # print 10 dec("c8") # print 200 30.26 Str2hex() Function We can convert string characters to hexadecimal characters using the Str2hex() function. Syntax: Str2hex(string) ---> hexadecimal string Example: See str2hex("hello") # print 68656c6c6f 30.27 Hex2str() Function We can convert hexadecimal characters to string using the Hex2str() function Syntax: Hex2Str(Hexadecimal string) ---> string Example: See hex2str("68656c6c6f") # print hello 30.26. Str2hex() Function 231
  • 10. CHAPTER THIRTYONE MATHEMATICAL FUNCTIONS In this chapter we are going to learn about the mathematical functions 31.1 List of functions The Ring programming language comes with the next mathematical functions Function Description sin(x) Returns the sine of an angle of x radians cos(x) Returns the cosine of an angle of x radians tan(x) Returns the tangent of an angle of x radians asin(x) Returns the principal value of the arc sine of x, expressed in radians acos(x) Returns the principal value of the arc cosine of x, expressed in radians atan(x) Returns the principal value of the arc tangent of x, expressed in radians atan2(y,x) Returns the principal arc tangent of y/x, in the interval [-pi,+pi] radians sinh(x) Returns the hyperbolic sine of x radians cosh(x) Returns the hyperbolic cosine of x radians tanh(x) Returns the hyperbolic tangent of x radians exp(x) Returns the value of e raised to the xth power log(x) Returns the natural logarithm of x log10(x) Returns the common logarithm (base-10 logarithm) of x ceil(x) Returns the smallest integer value greater than or equal to x floor(x) Returns the largest integer value less than or equal to x fabs(x) Returns the absolute value of x. pow(x,y) Returns x raised to the power of y sqrt(x) Returns the square root of x random(x) Returns a random number in the range [0,x] unsigned(n,n,c) Perform operation using unsigned numbers decimals(n) Determine the decimals digits after the point in float/double numbers 31.2 Example See "Mathematical Functions" + nl See "Sin(0) = " + sin(0) + nl See "Sin(90) radians = " + sin(90) + nl See "Sin(90) degree = " + sin(90*3.14/180) + nl See "Cos(0) = " + cos(0) + nl See "Cos(90) radians = " + cos(90) + nl 232