Академический Документы
Профессиональный Документы
Культура Документы
Example:
Load "stdlib.ring"
Example:
Load "stdlib.ring"
Example:
Load "stdlib.ring"
Example:
Load "stdlib.ring"
Example:
Load "stdlib.ring"
Example:
Load "stdlib.ring"
Puts("Test Substring()")
a = "abcxyzqweabc"
b = "abc"
i = 4
see substring(a,b,i)
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
Example:
Load "stdlib.ring"
Puts("Test Sleep()")
see "Wait 3 Seconds!"
Sleep(3)
see nl
Example:
Load "stdlib.ring"
if ismainsourcefile()
# code
ok
Example:
Load "stdlib.ring"
Make Directory
Syntax:
MakeDir(String)
Example:
Load "stdlib.ring"
# Create Directory
puts("create Directory : myfolder")
makedir("myfolder")
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
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
Example:
see EpochTime( Date(), Time() )
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
Using this function we can quickly do a process on a group of files in a folder and its sub folders.
Syntax:
ListAllFiles(cFolder,cExtension) ---> List of Files
Example:
Example:
see listallfiles("b:/ring/ringlibs/weblib","") # All Files
FORTYFOUR
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
Attributes:
vValue : Object Value
Methods:
301
Ring Documentation, Release 1.5
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)
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
Ring programming language
Ring
***Ring*** programming language
******Ring****** programming language
FirstSecond
FirstFirstFirst
FirstFirstFirst
one
two
three
Hello
How are you?