SlideShare a Scribd company logo
Ring Documentation, Release 1.10
48.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
48.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
48.52 EpochTime() function
Return the Epoch Time
Syntax:
EpochTime(cDate,cTime) ---> nEpochTime
Example:
see EpochTime( Date(), Time() )
48.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
48.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:
48.50. TrimLeft() function 408
Ring Documentation, Release 1.10
aList = ListAllFiles("c:/ring/ringlibs","ring") # *.ring only
aList = sort(aList)
see aList
Example:
see listallfiles("b:/ring/ringlibs/weblib","") # All Files
48.55 SystemSilent() Function
We can execute system commands using the SystemSilent() function to avoid displaying the output!
Syntax:
SystemSilent(cCommand)
48.56 OSCreateOpenFolder() Function
Create folder then change the current folder to this new folder
Syntax:
OSCreateOpenFolder(cCommand)
48.57 OSCopyFolder() Function
Copy folder to the current folder
Parameters : The path to the parent folder and the folder name to copy
Syntax:
OSCopyFolder(cParentFolder,cFolderName)
Example
To copy the folder b:ringringlibsstdlib to the current folder
OSCopyFolder("b:ringringlibs","stdlib")
48.58 OSDeleteFolder() Function
Delete Folder in the current Directory
Syntax:
OSDeleteFolder(cFolderName)
48.55. SystemSilent() Function 409
Ring Documentation, Release 1.10
48.59 OSCopyFile() Function
Copy File to the current directory
Syntax:
OSCopyFile(cFileName)
48.60 OSDeleteFile() Function
Delete File
Syntax:
OSDeleteFile(cFileName)
48.61 OSRenameFile() Function
Rename File
Syntax:
OSRenameFile(cOldFileName,cNewFileName)
48.62 List2Code() Function
This function convert a Ring list during the runtime to Ring source code that we can save to source files.
The list may contains strings, numbers or sub lists.
Example:
load "stdlibcore.ring"
aList = 1:10
? list2Code(aList)
Output:
[
1,2,3,4,5,6,7,8,9,10
]
48.63 Str2ASCIIList()
Convert a string of bytes to a list of numbers where each item represent the ASCII code of one byte in the string.
Syntax:
Str2ASCIIList(String) ---> List of numbers
48.59. OSCopyFile() Function 410
Ring Documentation, Release 1.10
48.64 ASCIIList2Str()
Convert a list of numbers where each item represent the ASCII code of one byte to a string of bytes.
Syntax:
ASCIIList2Str(List of numbers) ---> String
Example:
load "stdlibcore.ring"
cStr = "MmMm"
aList = Str2ASCIILIST(cStr)
? aList
cStr2 = ASCIIList2Str(aList)
? cStr2
? len(cStr2)
Output:
77
109
77
109
MmMm
4
48.64. ASCIIList2Str() 411
CHAPTER
FORTYNINE
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
• PostgreSQL Class
• Security Class
• Internet Class
49.1 StdBase Class
Attributes:
• vValue : Object Value
412
Ring Documentation, Release 1.10
Methods:
Method Description/Output
Init(x) Set vValue Attribute to x value
Print() Print vValue
PrintLn() Print vValue then New Line
Size() return number represent the size of vValue
Value() return vValue
Set(x) Call Init(x)
49.2 String Class
Parent Class : StdBase Class
Methods:
Method Description/Output
Init(String|Number|List)
Lower() New String - Lower case characters
Upper() New String - Upper case characters
Left(x) New String - contains x characters from the left
Right(x) New String - contains x characters from the right
Lines() Number - Lines count
Trim() New String - Remove Spaces
Copy(x) New String - repeat string x times
strcmp(cString) Compare string with cString
tolist() List (String Lines to String Items)
tofile(cFileName) Write string to file
mid(nPos1,nPos2) New String - from nPos1 to nPos2
getfrom(nPos1) New String - from nPos1 to the end of the string
replace(cStr1,cStr2,lCase) New String - Replace cStr1 with cStr2 , lCase (True=Match Case)
split() List - Each Word as list item
startswith(substring) Return true if the start starts with a substring
endswith(substring) Return true if the start ends with a substring
Example:
Load "stdlib.ring"
See "Testing the String Class" + nl
oString = new string("Hello, World!")
oString.println()
oString.upper().println()
oString.lower().println()
oString.left(5).println()
oString.right(6).println()
oString = new string("Hi" + nl + "Hello" )
See oString.lines() + nl
oString = new string(" Welcome ")
oString.println()
oString.trim().println()
oString = new string("Hello! ")
oString.copy(3).println()
see oString.strcmp("Hello! ") + nl
see oString.strcmp("Hello ") + nl
see oString.strcmp("Hello!! ") + nl
49.2. String Class 413
Ring Documentation, Release 1.10
oString = new string(["one","two","three"])
oString.print()
see oString.lines() + nl
oString = new String(1234)
oString.println()
oString = new String("one"+nl+"two"+nl+"three")
aList = oString.tolist()
see "List Items" + nl See aList
oString = new String( "Welcome to the Ring programming language")
See "the - position : " + oString.pos("the") + nl
oString = oString.getfrom(oString.pos("Ring"))
oString.println()
oString.mid(1,4).println()
oString = oString.replace("Ring","***Ring***",true)
oString.println()
oString = oString.replace("ring","***Ring***",false)
oString.println()
oString1 = new string("First")
oString2 = new string("Second")
oString = oString1 + oString2
oString.println()
oString = oString1 * 3
oString.println()
for t in ostring see t next
oString.tofile("test.txt")
oString = new string("one two three")
see nl
see ostring.split()
oString {
set("Hello") println()
set("How are you?") println()
}
Output:
Testing the String Class
Hello, World!
HELLO, WORLD!
hello, world!
Hello
World!
2
Welcome
Welcome
Hello! Hello! Hello!
0
1
-1
one
two
three
4
1234
List Items
one
two
three
the - position : 12
49.2. String Class 414
Ring Documentation, Release 1.10
Ring programming language
Ring
***Ring*** programming language
******Ring****** programming language
FirstSecond
FirstFirstFirst
FirstFirstFirst
one
two
three
Hello
How are you?
49.3 List Class
Parent Class : StdBase Class
Methods:
Method Description/Output
Init(String|List)
Add(Value) Add item to the list
Delete(nIndex) Delete item from the list
Item(nIndex) Get item from the list
First() Get the first item in the list
Last() Get the last item in the list
Set(nIndex,Value) Set item value
FindInColumn(nCol,Value) Find item in a column
Sort() Sort items - return new list
Reverse() Reverse items - return new list
Insert(nIndex,Value) Inset Item after nIndex
example:
Load "stdlib.ring"
oList = new list ( [1,2,3] )
oList.Add(4)
oList.print()
see oList.item(1) + nl
oList.delete(4)
oList.print()
see oList.first() + nl
see oList.last() + nl
oList { set(1,"one") set(2,"two") set(3,"three") print() }
see oList.find("two") + nl
oList.sort().print()
oList.reverse().print()
oList.insert(2,"nice")
oList.print()
oList = new list ( [ [1,"one"],[2,"two"],[3,"three"] ] )
see copy("*",10) + nl
oList.print()
see "Search two : " + oList.findincolumn(2,"two") + nl
see "Search 1 : " + oList.findincolumn(1,1) + nl
oList = new list ( [ "Egypt" , "USA" , "KSA" ] )
49.3. List Class 415
Ring Documentation, Release 1.10
for x in oList
see x + nl
next
oList = new list ( [1,2,3,4] )
oList + [5,6,7]
oList.print()
oList = new list ( ["one","two"] )
oList2 = new list ( ["three","four"] )
oList + oList2
oList.print()
output:
1
2
3
4
1
1
2
3
1
3
one
two
three
2
one
three
two
three
two
one
one
two
nice
three
**********
1
one
2
two
3
three
Search two : 2
Search 1 : 1
Egypt
USA
KSA
1
2
3
4
5
6
7
one
two
49.3. List Class 416
Ring Documentation, Release 1.10
three
four
49.4 Stack Class
Parent Class : List Class
Methods:
Method Description/Output
Init(String|Number|List)
Push(Value) Push item to the stack
Pop() Pop item from the stack
Print() Print the stack items
example:
Load "stdlib.ring"
oStack = new Stack
oStack.push(1)
oStack.push(2)
oStack.push(3)
see oStack.pop() + nl
see oStack.pop() + nl
see oStack.pop() + nl
oStack.push(4)
see oStack.pop() + nl
oStack { push("one") push("two") push("three") }
oStack.print()
output:
3
2
1
4
three
two
one
49.5 Queue Class
Parent Class : List Class
Methods:
Method Description/Output
Init(String|Number|List)
Remove() Remove item from the Queue.
example:
Load "stdlib.ring"
oQueue = new Queue
49.4. Stack Class 417

More Related Content

What's hot (20)

PDF
The Ring programming language version 1.10 book - Part 43 of 212
Mahmoud Samir Fayed
 
PDF
Taming Asynchronous Transforms with Interstellar
Jens Ravens
 
PDF
The Ring programming language version 1.8 book - Part 94 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 33 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 25 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 23 of 185
Mahmoud Samir Fayed
 
PDF
All You Need is Fold in the Key of C#
Mike Harris
 
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.5.4 book - Part 22 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 34 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 31 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 43 of 210
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.5.4 book - Part 36 of 185
Mahmoud Samir Fayed
 
PDF
ScalaMeter 2014
Aleksandar Prokopec
 
PDF
Clojure for Data Science
henrygarner
 
PDF
Beyond tf idf why, what & how
lucenerevolution
 
PPTX
Kotlin standard
Myeongin Woo
 
PDF
The Ring programming language version 1.5.3 book - Part 22 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 43 of 212
Mahmoud Samir Fayed
 
Taming Asynchronous Transforms with Interstellar
Jens Ravens
 
The Ring programming language version 1.8 book - Part 94 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 33 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 25 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 23 of 185
Mahmoud Samir Fayed
 
All You Need is Fold in the Key of C#
Mike Harris
 
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.5.4 book - Part 22 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 34 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 31 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 43 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 39 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 36 of 185
Mahmoud Samir Fayed
 
ScalaMeter 2014
Aleksandar Prokopec
 
Clojure for Data Science
henrygarner
 
Beyond tf idf why, what & how
lucenerevolution
 
Kotlin standard
Myeongin Woo
 
The Ring programming language version 1.5.3 book - Part 22 of 184
Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.10 book - Part 45 of 212 (20)

PDF
The Ring programming language version 1.7 book - Part 39 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 41 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 34 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 40 of 202
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.3 book - Part 14 of 88
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.9 book - Part 42 of 210
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.4 book - Part 37 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 22 of 181
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.3 book - Part 23 of 184
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.2 book - Part 12 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 23 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 26 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 28 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 30 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 34 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 39 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 41 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 34 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 40 of 202
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.3 book - Part 14 of 88
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.9 book - Part 42 of 210
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.4 book - Part 37 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 22 of 181
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.3 book - Part 23 of 184
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.2 book - Part 12 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 23 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 26 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 28 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 30 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 34 of 184
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)

PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Tally software_Introduction_Presentation
AditiBansal54083
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 

The Ring programming language version 1.10 book - Part 45 of 212

  • 1. Ring Documentation, Release 1.10 48.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 48.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 48.52 EpochTime() function Return the Epoch Time Syntax: EpochTime(cDate,cTime) ---> nEpochTime Example: see EpochTime( Date(), Time() ) 48.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 48.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: 48.50. TrimLeft() function 408
  • 2. Ring Documentation, Release 1.10 aList = ListAllFiles("c:/ring/ringlibs","ring") # *.ring only aList = sort(aList) see aList Example: see listallfiles("b:/ring/ringlibs/weblib","") # All Files 48.55 SystemSilent() Function We can execute system commands using the SystemSilent() function to avoid displaying the output! Syntax: SystemSilent(cCommand) 48.56 OSCreateOpenFolder() Function Create folder then change the current folder to this new folder Syntax: OSCreateOpenFolder(cCommand) 48.57 OSCopyFolder() Function Copy folder to the current folder Parameters : The path to the parent folder and the folder name to copy Syntax: OSCopyFolder(cParentFolder,cFolderName) Example To copy the folder b:ringringlibsstdlib to the current folder OSCopyFolder("b:ringringlibs","stdlib") 48.58 OSDeleteFolder() Function Delete Folder in the current Directory Syntax: OSDeleteFolder(cFolderName) 48.55. SystemSilent() Function 409
  • 3. Ring Documentation, Release 1.10 48.59 OSCopyFile() Function Copy File to the current directory Syntax: OSCopyFile(cFileName) 48.60 OSDeleteFile() Function Delete File Syntax: OSDeleteFile(cFileName) 48.61 OSRenameFile() Function Rename File Syntax: OSRenameFile(cOldFileName,cNewFileName) 48.62 List2Code() Function This function convert a Ring list during the runtime to Ring source code that we can save to source files. The list may contains strings, numbers or sub lists. Example: load "stdlibcore.ring" aList = 1:10 ? list2Code(aList) Output: [ 1,2,3,4,5,6,7,8,9,10 ] 48.63 Str2ASCIIList() Convert a string of bytes to a list of numbers where each item represent the ASCII code of one byte in the string. Syntax: Str2ASCIIList(String) ---> List of numbers 48.59. OSCopyFile() Function 410
  • 4. Ring Documentation, Release 1.10 48.64 ASCIIList2Str() Convert a list of numbers where each item represent the ASCII code of one byte to a string of bytes. Syntax: ASCIIList2Str(List of numbers) ---> String Example: load "stdlibcore.ring" cStr = "MmMm" aList = Str2ASCIILIST(cStr) ? aList cStr2 = ASCIIList2Str(aList) ? cStr2 ? len(cStr2) Output: 77 109 77 109 MmMm 4 48.64. ASCIIList2Str() 411
  • 5. CHAPTER FORTYNINE 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 • PostgreSQL Class • Security Class • Internet Class 49.1 StdBase Class Attributes: • vValue : Object Value 412
  • 6. Ring Documentation, Release 1.10 Methods: Method Description/Output Init(x) Set vValue Attribute to x value Print() Print vValue PrintLn() Print vValue then New Line Size() return number represent the size of vValue Value() return vValue Set(x) Call Init(x) 49.2 String Class Parent Class : StdBase Class Methods: Method Description/Output Init(String|Number|List) Lower() New String - Lower case characters Upper() New String - Upper case characters Left(x) New String - contains x characters from the left Right(x) New String - contains x characters from the right Lines() Number - Lines count Trim() New String - Remove Spaces Copy(x) New String - repeat string x times strcmp(cString) Compare string with cString tolist() List (String Lines to String Items) tofile(cFileName) Write string to file mid(nPos1,nPos2) New String - from nPos1 to nPos2 getfrom(nPos1) New String - from nPos1 to the end of the string replace(cStr1,cStr2,lCase) New String - Replace cStr1 with cStr2 , lCase (True=Match Case) split() List - Each Word as list item startswith(substring) Return true if the start starts with a substring endswith(substring) Return true if the start ends with a substring Example: Load "stdlib.ring" See "Testing the String Class" + nl oString = new string("Hello, World!") oString.println() oString.upper().println() oString.lower().println() oString.left(5).println() oString.right(6).println() oString = new string("Hi" + nl + "Hello" ) See oString.lines() + nl oString = new string(" Welcome ") oString.println() oString.trim().println() oString = new string("Hello! ") oString.copy(3).println() see oString.strcmp("Hello! ") + nl see oString.strcmp("Hello ") + nl see oString.strcmp("Hello!! ") + nl 49.2. String Class 413
  • 7. Ring Documentation, Release 1.10 oString = new string(["one","two","three"]) oString.print() see oString.lines() + nl oString = new String(1234) oString.println() oString = new String("one"+nl+"two"+nl+"three") aList = oString.tolist() see "List Items" + nl See aList oString = new String( "Welcome to the Ring programming language") See "the - position : " + oString.pos("the") + nl oString = oString.getfrom(oString.pos("Ring")) oString.println() oString.mid(1,4).println() oString = oString.replace("Ring","***Ring***",true) oString.println() oString = oString.replace("ring","***Ring***",false) oString.println() oString1 = new string("First") oString2 = new string("Second") oString = oString1 + oString2 oString.println() oString = oString1 * 3 oString.println() for t in ostring see t next oString.tofile("test.txt") oString = new string("one two three") see nl see ostring.split() oString { set("Hello") println() set("How are you?") println() } Output: Testing the String Class Hello, World! HELLO, WORLD! hello, world! Hello World! 2 Welcome Welcome Hello! Hello! Hello! 0 1 -1 one two three 4 1234 List Items one two three the - position : 12 49.2. String Class 414
  • 8. Ring Documentation, Release 1.10 Ring programming language Ring ***Ring*** programming language ******Ring****** programming language FirstSecond FirstFirstFirst FirstFirstFirst one two three Hello How are you? 49.3 List Class Parent Class : StdBase Class Methods: Method Description/Output Init(String|List) Add(Value) Add item to the list Delete(nIndex) Delete item from the list Item(nIndex) Get item from the list First() Get the first item in the list Last() Get the last item in the list Set(nIndex,Value) Set item value FindInColumn(nCol,Value) Find item in a column Sort() Sort items - return new list Reverse() Reverse items - return new list Insert(nIndex,Value) Inset Item after nIndex example: Load "stdlib.ring" oList = new list ( [1,2,3] ) oList.Add(4) oList.print() see oList.item(1) + nl oList.delete(4) oList.print() see oList.first() + nl see oList.last() + nl oList { set(1,"one") set(2,"two") set(3,"three") print() } see oList.find("two") + nl oList.sort().print() oList.reverse().print() oList.insert(2,"nice") oList.print() oList = new list ( [ [1,"one"],[2,"two"],[3,"three"] ] ) see copy("*",10) + nl oList.print() see "Search two : " + oList.findincolumn(2,"two") + nl see "Search 1 : " + oList.findincolumn(1,1) + nl oList = new list ( [ "Egypt" , "USA" , "KSA" ] ) 49.3. List Class 415
  • 9. Ring Documentation, Release 1.10 for x in oList see x + nl next oList = new list ( [1,2,3,4] ) oList + [5,6,7] oList.print() oList = new list ( ["one","two"] ) oList2 = new list ( ["three","four"] ) oList + oList2 oList.print() output: 1 2 3 4 1 1 2 3 1 3 one two three 2 one three two three two one one two nice three ********** 1 one 2 two 3 three Search two : 2 Search 1 : 1 Egypt USA KSA 1 2 3 4 5 6 7 one two 49.3. List Class 416
  • 10. Ring Documentation, Release 1.10 three four 49.4 Stack Class Parent Class : List Class Methods: Method Description/Output Init(String|Number|List) Push(Value) Push item to the stack Pop() Pop item from the stack Print() Print the stack items example: Load "stdlib.ring" oStack = new Stack oStack.push(1) oStack.push(2) oStack.push(3) see oStack.pop() + nl see oStack.pop() + nl see oStack.pop() + nl oStack.push(4) see oStack.pop() + nl oStack { push("one") push("two") push("three") } oStack.print() output: 3 2 1 4 three two one 49.5 Queue Class Parent Class : List Class Methods: Method Description/Output Init(String|Number|List) Remove() Remove item from the Queue. example: Load "stdlib.ring" oQueue = new Queue 49.4. Stack Class 417