SlideShare a Scribd company logo
Ring Documentation, Release 1.5.2
Syntax:
Endswith(string, substring) ---> True/False
Example:
Load "stdlib.ring"
Puts("Test Endswith()")
see endsWith("CalmoSoft", "Soft") + nl
42.28 gcd() function
Finding of the greatest common divisor of two integers.
Syntax:
Gcd(number,number) ---> number
Example:
Load "stdlib.ring"
Puts("Test Gcd()")
see gcd (24, 32) + nl
42.29 lcm() function
Compute the least common multiple of two integers.
Syntax:
lcm(number,number) ---> number
Example:
Load "stdlib.ring"
Puts("Test Lcm()")
see Lcm(24,36) + nl
42.30 sumlist() function
Compute the sum of a list of integers.
Syntax:
sumlist(list) ---> number
Example:
Load "stdlib.ring"
Puts("Test Sumlist()")
42.28. gcd() function 305
Ring Documentation, Release 1.5.2
aList = [1,2,3,4,5]
see Sumlist(aList) + nl
42.31 prodlist() function
Compute the product of a list of integers.
Syntax:
prodlist(list) ---> number
Example:
Load "stdlib.ring"
Puts("Test Prodlist()")
aList = [1,2,3,4,5]
see Prodlist(aList) + nl
42.32 evenorodd() function
Test whether an integer is even or odd.
Result of test (1=odd 2=even).
Syntax:
evenorodd(number) ---> 1 (odd) or 2 (even)
Example:
Load "stdlib.ring"
Puts("Test Evenorodd()")
nr = 17
see Evenorodd(nr) + nl
42.33 factors() function
Compute the factors of a positive integer.
Syntax:
factors(list) ---> list
Example:
Load "stdlib.ring"
Puts("Test Factors()")
n = 45
aList = factors(n)
see "Factors of " + n + " = "
for i = 1 to len(aList)
42.31. prodlist() function 306
Ring Documentation, Release 1.5.2
see "" + aList[i] + " "
next
42.34 palindrome() function
Check if a sequence of characters is a palindrome or not.
Syntax:
Palindrome(String) ---> True/False
Example:
Load "stdlib.ring"
Puts("Test Palindrome()")
cString = "radar"
see Palindrome(cString)
42.35 isleapyear() function
Check whether a given year is a leap year in the Gregorian calendar.
Syntax:
Isleapyear(number) ---> True/False
Example:
Load "stdlib.ring"
Puts("Test Isleapyear()")
year = 2016
if Isleapyear(year) see "" + year + " is a leap year."
else see "" + year + " is not a leap year." ok
42.36 binarydigits() function
Compute the sequence of binary digits for a given non-negative integer.
Syntax:
binarydigits(number) ---> string
Example:
Load "stdlib.ring"
Puts("Test Binarydigits()")
b = 35
see "Binary digits of " + b + " = " + Binarydigits(b)
42.34. palindrome() function 307
Ring Documentation, Release 1.5.2
42.37 matrixmulti() function
Multiply two matrices together.
Syntax:
Matrixmulti(List,List) ---> List
Example:
Load "stdlib.ring"
# Multiply two matrices together.
Puts("Test Matrixmulti()")
A = [[1,2,3], [4,5,6], [7,8,9]]
B = [[1,0,0], [0,1,0], [0,0,1]]
see Matrixmulti(A, B)
42.38 matrixtrans() function
Transpose an arbitrarily sized rectangular Matrix.
Syntax:
Matrixtrans(List) ---> List
Example:
Load "stdlib.ring"
# Transpose an arbitrarily sized rectangular Matrix.
Puts("Test Matrixtrans()")
matrix = [[78,19,30,12,36], [49,10,65,42,50], [30,93,24,78,10], [39,68,27,64,29]]
see Matrixtrans(matrix)
42.39 dayofweek() function
Return the day of the week of given date. (yyyy-mm-dd)
Syntax:
dayofweek(string) ---> string
Example:
Load "stdlib.ring"
# Return the day of the week of given date.
Puts("Test Dayofweek()")
date = "2016-04-24"
see "Data : " + date + " - Day : " + Dayofweek(date) + nl
42.37. matrixmulti() function 308
Ring Documentation, Release 1.5.2
42.40 permutation() function
Generates all permutations of n different numerals.
Syntax:
permutation(list)
Example:
Load "stdlib.ring"
# Generates all permutations of n different numerals
Puts("Test Permutation()")
list = [1, 2, 3, 4]
for perm = 1 to 24
for i = 1 to len(list)
see list[i] + " "
next
see nl
Permutation(list)
next
42.41 readline() function
Read line from file
Syntax:
readline(fp) ---> string
Example:
Load "stdlib.ring"
# Read a file line by line.
Puts("Test Readline()")
fp = fopen("test.ring","r")
while not feof(fp)
See Readline(fp) end
fclose(fp)
42.42 substring() function
Return a position of a substring starting from a given position in a string.
Syntax:
Substring(str,substr,npos) ---> string
Example:
Load "stdlib.ring"
# Return a position of a substring starting from a given position in a string.
42.40. permutation() function 309
Ring Documentation, Release 1.5.2
Puts("Test Substring()")
a = "abcxyzqweabc"
b = "abc"
i = 4
see substring(a,b,i)
42.43 changestring() function
Change substring from given position to a given position with another substring.
Syntax:
Changestring(cString, nPos1, nPos2, cSubstr) ---> cString
Example:
Load "stdlib.ring"
# Change substring from given position for given position with a substring.
Puts("Test Changestring()")
see Changestring("Rmasdg",2,5,"in") # Ring
42.44 sleep() function
Sleep for the given amount of time.
Syntax:
sleep(nSeconds)
Example:
Load "stdlib.ring"
Puts("Test Sleep()")
see "Wait 3 Seconds!"
Sleep(3)
see nl
42.45 ismainsourcefile() function
Check if the current file is the main source file
Syntax:
IsMainSourceFile() ---> True/False
Example:
Load "stdlib.ring"
if ismainsourcefile()
# code
ok
42.43. changestring() function 310
Ring Documentation, Release 1.5.2
42.46 direxists() function
Check if directory exists
Syntax:
DirExists(String) ---> True/False
Example:
Load "stdlib.ring"
see "Check dir : b:ring "
puts( DirExists("b:ring") )
see "Check dir : C:ring "
Puts( DirExists("C:ring") )
42.47 makedir() function
Make Directory
Syntax:
MakeDir(String)
Example:
Load "stdlib.ring"
# Create Directory
puts("create Directory : myfolder")
makedir("myfolder")
42.48 fsize() function
The function return the file size in bytes.
Syntax:
FSize(File Handle) ---> Number (File Size in Bytes)
42.49 trimall() function
Remove all spaces and tabs characters from a string
Syntax:
TrimAll(cString) ---> cString # Without Spaces and Tabs
42.46. direxists() function 311
Ring Documentation, Release 1.5.2
42.50 trimleft() function
Remove all spaces and tabs characters from the left side of a string
Syntax:
TrimLeft(cString) ---> cString # Without Spaces and Tabs from the left side
42.51 trimright() function
Remove all spaces and tabs characters from the right side of a string
Syntax:
TrimRight(cString) ---> cString # Without Spaces and Tabs from the right side
42.52 epochtime() function
Return the Epoch Time
Syntax:
EpochTime(cDate,cTime) ---> nEpochTime
Example:
see EpochTime( Date(), Time() )
42.53 SystemCmd() Function
We can execute system commands using the SystemCmd() function that outputs to a variable
Syntax:
SystemCmd(cCommand)
Example:
cYou = SystemCmd("whoami") # User Name logged in is output a variable
cThem = SystemCmd("dir c:Users") # Directory List is output to a variable
42.54 ListAllFiles() Function
Using this function we can quickly do a process on a group of files in a folder and it’s sub folders.
Syntax:
ListAllFiles(cFolder,cExtension) ---> List of Files
Example:
42.50. trimleft() function 312
Ring Documentation, Release 1.5.2
aList = ListAllFiles("c:/ring/ringlibs","ring") # *.ring only
aList = sort(aList)
see aList
Example:
see listallfiles("b:/ring/ringlibs/weblib","") # All Files
42.54. ListAllFiles() Function 313
CHAPTER
FORTYTHREE
STDLIB CLASSES
In this chapter we are going to learn about the classes in the stdlib.ring
• StdBase Class
• String Class
• List Class
• Stack Class
• Queue Class
• HashTable Class
• Tree Class
• Math Class
• DateTime Class
• File Class
• System Class
• Debug Class
• DataType Class
• Conversion Class
• ODBC CLass
• MySQL Class
• SQLite Class
• Security Class
• Internet Class
43.1 StdBase Class
Attributes:
• vValue : Object Value
Methods:
314

More Related Content

PDF
The Ring programming language version 1.9 book - Part 43 of 210
PDF
The Ring programming language version 1.5.4 book - Part 35 of 185
PDF
The Ring programming language version 1.8 book - Part 40 of 202
PDF
The Ring programming language version 1.5.1 book - Part 33 of 180
PDF
The Ring programming language version 1.7 book - Part 38 of 196
PDF
The Ring programming language version 1.6 book - Part 37 of 189
PDF
The Ring programming language version 1.5.4 book - Part 34 of 185
PDF
The Ring programming language version 1.3 book - Part 25 of 88
The Ring programming language version 1.9 book - Part 43 of 210
The Ring programming language version 1.5.4 book - Part 35 of 185
The Ring programming language version 1.8 book - Part 40 of 202
The Ring programming language version 1.5.1 book - Part 33 of 180
The Ring programming language version 1.7 book - Part 38 of 196
The Ring programming language version 1.6 book - Part 37 of 189
The Ring programming language version 1.5.4 book - Part 34 of 185
The Ring programming language version 1.3 book - Part 25 of 88

What's hot (20)

PDF
The Ring programming language version 1.9 book - Part 42 of 210
PDF
The Ring programming language version 1.10 book - Part 45 of 212
PDF
The Ring programming language version 1.9 book - Part 33 of 210
PDF
The Ring programming language version 1.10 book - Part 43 of 212
PDF
The Ring programming language version 1.2 book - Part 24 of 84
PDF
The Ring programming language version 1.3 book - Part 50 of 88
PDF
The Ring programming language version 1.10 book - Part 35 of 212
PDF
The Ring programming language version 1.5.2 book - Part 35 of 181
PDF
The Ring programming language version 1.4.1 book - Part 9 of 31
PDF
How to Clone Flappy Bird in Swift
PDF
The Ring programming language version 1.5.3 book - Part 77 of 184
PDF
Taming Asynchronous Transforms with Interstellar
ODP
Groovy intro for OUDL
PDF
The Ring programming language version 1.5.4 book - Part 26 of 185
PDF
The Ring programming language version 1.4 book - Part 18 of 30
PDF
The Ring programming language version 1.4.1 book - Part 3 of 31
PDF
Functional Programming for OO Programmers (part 2)
TXT
Procesos
PDF
The Ring programming language version 1.3 book - Part 23 of 88
PDF
Go ahead, make my day
The Ring programming language version 1.9 book - Part 42 of 210
The Ring programming language version 1.10 book - Part 45 of 212
The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.10 book - Part 43 of 212
The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.3 book - Part 50 of 88
The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.5.2 book - Part 35 of 181
The Ring programming language version 1.4.1 book - Part 9 of 31
How to Clone Flappy Bird in Swift
The Ring programming language version 1.5.3 book - Part 77 of 184
Taming Asynchronous Transforms with Interstellar
Groovy intro for OUDL
The Ring programming language version 1.5.4 book - Part 26 of 185
The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4.1 book - Part 3 of 31
Functional Programming for OO Programmers (part 2)
Procesos
The Ring programming language version 1.3 book - Part 23 of 88
Go ahead, make my day
Ad

Similar to The Ring programming language version 1.5.2 book - Part 34 of 181 (20)

PDF
The Ring programming language version 1.10 book - Part 44 of 212
PDF
The Ring programming language version 1.5.3 book - Part 34 of 184
PDF
The Ring programming language version 1.3 book - Part 26 of 88
PDF
The Ring programming language version 1.5.2 book - Part 33 of 181
PDF
The Ring programming language version 1.5.3 book - Part 35 of 184
PDF
The Ring programming language version 1.5.1 book - Part 32 of 180
PDF
The Ring programming language version 1.6 book - Part 36 of 189
PDF
The Ring programming language version 1.8 book - Part 39 of 202
PDF
The Ring programming language version 1.2 book - Part 23 of 84
PDF
The Ring programming language version 1.7 book - Part 37 of 196
PDF
The Ring programming language version 1.7 book - Part 30 of 196
PDF
The Ring programming language version 1.2 book - Part 16 of 84
PDF
The Ring programming language version 1.5.2 book - Part 26 of 181
PDF
The Ring programming language version 1.4.1 book - Part 7 of 31
PDF
The Ring programming language version 1.10 book - Part 34 of 212
PDF
The Ring programming language version 1.4.1 book - Part 10 of 31
PDF
The Ring programming language version 1.3 book - Part 16 of 88
PDF
The Ring programming language version 1.5.3 book - Part 23 of 184
PDF
The Ring programming language version 1.7 book - Part 39 of 196
PDF
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.10 book - Part 44 of 212
The Ring programming language version 1.5.3 book - Part 34 of 184
The Ring programming language version 1.3 book - Part 26 of 88
The Ring programming language version 1.5.2 book - Part 33 of 181
The Ring programming language version 1.5.3 book - Part 35 of 184
The Ring programming language version 1.5.1 book - Part 32 of 180
The Ring programming language version 1.6 book - Part 36 of 189
The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.2 book - Part 23 of 84
The Ring programming language version 1.7 book - Part 37 of 196
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.2 book - Part 16 of 84
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.4.1 book - Part 7 of 31
The Ring programming language version 1.10 book - Part 34 of 212
The Ring programming language version 1.4.1 book - Part 10 of 31
The Ring programming language version 1.3 book - Part 16 of 88
The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.7 book - Part 39 of 196
The Ring programming language version 1.5.3 book - Part 25 of 184
Ad

More from Mahmoud Samir Fayed (20)

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

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
cuic standard and advanced reporting.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
The Rise and Fall of 3GPP – Time for a Sabbatical?
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf
MIND Revenue Release Quarter 2 2025 Press Release
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Big Data Technologies - Introduction.pptx
Understanding_Digital_Forensics_Presentation.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Electronic commerce courselecture one. Pdf

The Ring programming language version 1.5.2 book - Part 34 of 181

  • 1. Ring Documentation, Release 1.5.2 Syntax: Endswith(string, substring) ---> True/False Example: Load "stdlib.ring" Puts("Test Endswith()") see endsWith("CalmoSoft", "Soft") + nl 42.28 gcd() function Finding of the greatest common divisor of two integers. Syntax: Gcd(number,number) ---> number Example: Load "stdlib.ring" Puts("Test Gcd()") see gcd (24, 32) + nl 42.29 lcm() function Compute the least common multiple of two integers. Syntax: lcm(number,number) ---> number Example: Load "stdlib.ring" Puts("Test Lcm()") see Lcm(24,36) + nl 42.30 sumlist() function Compute the sum of a list of integers. Syntax: sumlist(list) ---> number Example: Load "stdlib.ring" Puts("Test Sumlist()") 42.28. gcd() function 305
  • 2. Ring Documentation, Release 1.5.2 aList = [1,2,3,4,5] see Sumlist(aList) + nl 42.31 prodlist() function Compute the product of a list of integers. Syntax: prodlist(list) ---> number Example: Load "stdlib.ring" Puts("Test Prodlist()") aList = [1,2,3,4,5] see Prodlist(aList) + nl 42.32 evenorodd() function Test whether an integer is even or odd. Result of test (1=odd 2=even). Syntax: evenorodd(number) ---> 1 (odd) or 2 (even) Example: Load "stdlib.ring" Puts("Test Evenorodd()") nr = 17 see Evenorodd(nr) + nl 42.33 factors() function Compute the factors of a positive integer. Syntax: factors(list) ---> list Example: Load "stdlib.ring" Puts("Test Factors()") n = 45 aList = factors(n) see "Factors of " + n + " = " for i = 1 to len(aList) 42.31. prodlist() function 306
  • 3. Ring Documentation, Release 1.5.2 see "" + aList[i] + " " next 42.34 palindrome() function Check if a sequence of characters is a palindrome or not. Syntax: Palindrome(String) ---> True/False Example: Load "stdlib.ring" Puts("Test Palindrome()") cString = "radar" see Palindrome(cString) 42.35 isleapyear() function Check whether a given year is a leap year in the Gregorian calendar. Syntax: Isleapyear(number) ---> True/False Example: Load "stdlib.ring" Puts("Test Isleapyear()") year = 2016 if Isleapyear(year) see "" + year + " is a leap year." else see "" + year + " is not a leap year." ok 42.36 binarydigits() function Compute the sequence of binary digits for a given non-negative integer. Syntax: binarydigits(number) ---> string Example: Load "stdlib.ring" Puts("Test Binarydigits()") b = 35 see "Binary digits of " + b + " = " + Binarydigits(b) 42.34. palindrome() function 307
  • 4. Ring Documentation, Release 1.5.2 42.37 matrixmulti() function Multiply two matrices together. Syntax: Matrixmulti(List,List) ---> List Example: Load "stdlib.ring" # Multiply two matrices together. Puts("Test Matrixmulti()") A = [[1,2,3], [4,5,6], [7,8,9]] B = [[1,0,0], [0,1,0], [0,0,1]] see Matrixmulti(A, B) 42.38 matrixtrans() function Transpose an arbitrarily sized rectangular Matrix. Syntax: Matrixtrans(List) ---> List Example: Load "stdlib.ring" # Transpose an arbitrarily sized rectangular Matrix. Puts("Test Matrixtrans()") matrix = [[78,19,30,12,36], [49,10,65,42,50], [30,93,24,78,10], [39,68,27,64,29]] see Matrixtrans(matrix) 42.39 dayofweek() function Return the day of the week of given date. (yyyy-mm-dd) Syntax: dayofweek(string) ---> string Example: Load "stdlib.ring" # Return the day of the week of given date. Puts("Test Dayofweek()") date = "2016-04-24" see "Data : " + date + " - Day : " + Dayofweek(date) + nl 42.37. matrixmulti() function 308
  • 5. Ring Documentation, Release 1.5.2 42.40 permutation() function Generates all permutations of n different numerals. Syntax: permutation(list) Example: Load "stdlib.ring" # Generates all permutations of n different numerals Puts("Test Permutation()") list = [1, 2, 3, 4] for perm = 1 to 24 for i = 1 to len(list) see list[i] + " " next see nl Permutation(list) next 42.41 readline() function Read line from file Syntax: readline(fp) ---> string Example: Load "stdlib.ring" # Read a file line by line. Puts("Test Readline()") fp = fopen("test.ring","r") while not feof(fp) See Readline(fp) end fclose(fp) 42.42 substring() function Return a position of a substring starting from a given position in a string. Syntax: Substring(str,substr,npos) ---> string Example: Load "stdlib.ring" # Return a position of a substring starting from a given position in a string. 42.40. permutation() function 309
  • 6. Ring Documentation, Release 1.5.2 Puts("Test Substring()") a = "abcxyzqweabc" b = "abc" i = 4 see substring(a,b,i) 42.43 changestring() function Change substring from given position to a given position with another substring. Syntax: Changestring(cString, nPos1, nPos2, cSubstr) ---> cString Example: Load "stdlib.ring" # Change substring from given position for given position with a substring. Puts("Test Changestring()") see Changestring("Rmasdg",2,5,"in") # Ring 42.44 sleep() function Sleep for the given amount of time. Syntax: sleep(nSeconds) Example: Load "stdlib.ring" Puts("Test Sleep()") see "Wait 3 Seconds!" Sleep(3) see nl 42.45 ismainsourcefile() function Check if the current file is the main source file Syntax: IsMainSourceFile() ---> True/False Example: Load "stdlib.ring" if ismainsourcefile() # code ok 42.43. changestring() function 310
  • 7. Ring Documentation, Release 1.5.2 42.46 direxists() function Check if directory exists Syntax: DirExists(String) ---> True/False Example: Load "stdlib.ring" see "Check dir : b:ring " puts( DirExists("b:ring") ) see "Check dir : C:ring " Puts( DirExists("C:ring") ) 42.47 makedir() function Make Directory Syntax: MakeDir(String) Example: Load "stdlib.ring" # Create Directory puts("create Directory : myfolder") makedir("myfolder") 42.48 fsize() function The function return the file size in bytes. Syntax: FSize(File Handle) ---> Number (File Size in Bytes) 42.49 trimall() function Remove all spaces and tabs characters from a string Syntax: TrimAll(cString) ---> cString # Without Spaces and Tabs 42.46. direxists() function 311
  • 8. Ring Documentation, Release 1.5.2 42.50 trimleft() function Remove all spaces and tabs characters from the left side of a string Syntax: TrimLeft(cString) ---> cString # Without Spaces and Tabs from the left side 42.51 trimright() function Remove all spaces and tabs characters from the right side of a string Syntax: TrimRight(cString) ---> cString # Without Spaces and Tabs from the right side 42.52 epochtime() function Return the Epoch Time Syntax: EpochTime(cDate,cTime) ---> nEpochTime Example: see EpochTime( Date(), Time() ) 42.53 SystemCmd() Function We can execute system commands using the SystemCmd() function that outputs to a variable Syntax: SystemCmd(cCommand) Example: cYou = SystemCmd("whoami") # User Name logged in is output a variable cThem = SystemCmd("dir c:Users") # Directory List is output to a variable 42.54 ListAllFiles() Function Using this function we can quickly do a process on a group of files in a folder and it’s sub folders. Syntax: ListAllFiles(cFolder,cExtension) ---> List of Files Example: 42.50. trimleft() function 312
  • 9. Ring Documentation, Release 1.5.2 aList = ListAllFiles("c:/ring/ringlibs","ring") # *.ring only aList = sort(aList) see aList Example: see listallfiles("b:/ring/ringlibs/weblib","") # All Files 42.54. ListAllFiles() Function 313
  • 10. CHAPTER FORTYTHREE STDLIB CLASSES In this chapter we are going to learn about the classes in the stdlib.ring • StdBase Class • String Class • List Class • Stack Class • Queue Class • HashTable Class • Tree Class • Math Class • DateTime Class • File Class • System Class • Debug Class • DataType Class • Conversion Class • ODBC CLass • MySQL Class • SQLite Class • Security Class • Internet Class 43.1 StdBase Class Attributes: • vValue : Object Value Methods: 314