SlideShare a Scribd company logo
1 of 10
Download to read offline
Ring Documentation, Release 1.10
myconnect ( [ :server = "myserver.com" , :port = 80 ,
:username = "mahmoud" , :password = "password" ] )
func myconnect mypara
# print connection details
see "User Name : " + mypara[:username] + nl +
"Password : " + mypara[:password] + nl +
"Server : " + mypara[:server] + nl +
"Port : " + mypara[:port]
31.18 Passing Parameters or Argumnents Using List Array
Passing Arguments or Parmameters to a Function in an array format
Example:
myList = [5,7,3,9] ### list with args or parms in an array
result = sum(myList)
See "Sum result: "+ result +n
func sum(aList)
acc = 0
sizeList = len(aList)
for i = 1 to sizeList
See aList[i] +nl
acc = acc + aList[i]
next
return acc
31.19 Creating a Multi-Dimensional Array using List
A Multi-Dimensional Array of any size can be built using recursion in a Function
Example:
###---------------------------------------------------------
### Create Array -- Dimensions Any Size: 3D, 4D, 5D etc
dimList = [4,3,4]
bList = createDimList(dimList)
###---------------------------------------------------------
### Populate the arrays using a counter 1 , 4x4x4 = 256 , 2x3x4x5x6 = 720
Counter = 1
for Col=1 to dimList[1]
for Row=1 to dimList[2]
for Dep=1 to dimList[3]
blist[Col][Row][Dep] = Counter
Counter++
next
next
31.18. Passing Parameters or Argumnents Using List Array 268
Ring Documentation, Release 1.10
next
###-----------------------------------------------
### Print the array elements in block format
for Col=1 to dimList[1]
for Row=1 to dimList[2]
for Dep=1 to dimList[3]
See bList[Col][Row][Dep] See " "
next
See nl
next
See nl
next
###===========================
### FUNCTIONS
###-----------------------------------------------------------------------
### Recursive Create a Dimension Array
### Call by passing an array of dimesions: dimList = [2,3,4,5]
### Drop the first entry every iteration call, making newParms
###
### Example:
### dimList = [4,2,3,2] <<< Number and size of dimensions in array format
### bList = createDimList(dimList) <<< Call using the array as input
func createDimList(dimArray)
sizeList = len(dimArray)
newParms = []
for i = 2 to sizeList
Add(newParms, dimArray[i])
next
alist = list(dimArray[1])
if sizeList = 1
return aList
ok
for t in alist
t = createDimList(newParms)
next
return alist
31.20 Swap Items
We can swap the list items using the Swap() function.
Example:
aList = [:one,:two,:four,:three]
see aList
31.20. Swap Items 269
Ring Documentation, Release 1.10
see copy("*",50) + nl
swap(aList,3,4)
see aList
Output
one
two
four
three
**************************************************
one
two
three
four
31.20. Swap Items 270
CHAPTER
THIRTYTWO
STRINGS
In this chapter we are going to learn about strings creation and manipulation.
32.1 String Literals
Syntax:
cStr = "This is a string"
cStr2 = 'Another string'
cStr3 = :JustAnotherString
cStr4 = `Yet "another" 'string' ! `
32.2 Get String Length
We can get the string length (letters count inside a string) using the len() function
Syntax:
len(string) ---> string length
Example:
cStr = "How are you?"
see cStr + nl
see "String size : " + len(cStr) + nl
32.3 Convert Letters Case
Syntax:
lower(string) ---> convert string letters to lower case
upper(string) ---> convert string letters to UPPER case
Example:
cStr = "Welcome To The Ring Programming Language"
see cStr + nl + upper(cStr) + nl + lower(cStr)
271
Ring Documentation, Release 1.10
32.4 Access String Letters
We can access a letter inside a string by the letter index
Syntax:
string[index] ---> get string letter
string[index] = letter # set string letter
Example:
# print user name letter by letter (each letter in new line)
See "Hello, Enter your name : " give cName
for x = 1 to len(cName)
see nl + cName[x]
next
We can use for in to get string letters.
Example:
# print user name letter by letter (each letter in new line)
See "Hello, Enter your name : " give cName
for x in cName
see nl + x
next
We can modify the string letters
Example:
# convert the first letter to UPPER case
See "Enter your name : " give cName
cName[1] = upper(cName[1])
see "Hello " + cName
32.5 Left() Function
We can get a specified number of characters from a string using the Left() function.
The starting position is 1.
Syntax:
Left(string,count)
Example:
see left("Hello World!",5) # print Hello
32.6 Right() Function
We can get a specified number of characters from a string using the Right() function.
32.4. Access String Letters 272
Ring Documentation, Release 1.10
The starting position is the last character on the right.
Syntax:
Right(string,count)
Example:
see Right("Hello World!",6) # print World!
32.7 Trim() Function
We can remove all leading and trailing spaces from a string using the Trim() function.
Syntax:
trim(string)
Example:
cMsg = " Welcome "
see trim(cMsg) # print Welcome
32.8 Copy() Function
We can duplicate a string more than one time using the copy() function.
Syntax:
copy(string,nCount) ---> string replicated nCount times
Example
see copy("***hello***",3) # print ***hello******hello******hello***
32.9 Lines() Function
We can count the number of lines inside a string using the Lines() function.
Syntax:
lines(string) ---> Number of lines inside the string
Example:
cStr = "Hello
How are you?
are you fine?"
see lines(cStr) # print 3
32.7. Trim() Function 273
Ring Documentation, Release 1.10
32.10 Substr() Function
We can work on sub strings inside a string using the substr() function. Using Substr() we can
• Find substring
• Get substring from position to end
• Get Number of characters from position
• Transform Substring To Another Substring
32.11 Find substring
Syntax:
substr(string,substring) ---> the starting position of substring in string
Example:
cStr = "Welcome to the Ring programming language"
see substr(cStr,"Ring") # print 16
32.12 Get substring from position to end
Syntax:
substr(string,position) ---> Get substring starting from position to end
Example:
cStr = "Welcome to the Ring programming language"
nPos = substr(cStr,"Ring") # nPos = 16
see substr(cStr,nPos) # print Ring programming language
32.13 Get Number of Characters From Position
Syntax:
substr(string,position,count) ---> Get characters starting from position
Example:
cStr = "Welcome to the Ring programming language"
nPos = substr(cStr,"Ring") # nPos = 16
see substr(cStr,nPos,4) # print Ring
32.14 Transform Substring To Another Substring
Syntax:
32.10. Substr() Function 274
Ring Documentation, Release 1.10
substr(string,substring,newsubstring) ---> Transformed string (Match case)
substr(string,substring,newsubstring,1) ---> Transformed string (Ignore case)
Example:
cStr = "Welcome to the New programming language"
see substr(cStr,"New","Ring") + nl # print Welcome to the Ring programming language
see substr(cStr,"new","Ring",1)+ nl # print Welcome to the Ring programming language
32.15 strcmp() Function
We can compare between two strings using the strcmp() function.
Syntax:
strcmp(cString1,cString2) ---> value = 0 if cString1 = cString2
value < 0 if cString1 < cString2
value > 0 if cString1 > cString2
Example:
see strcmp("hello","hello") + nl +
strcmp("abc","bcd") + nl +
strcmp("bcd","abc") + nl
Output:
0
-1
1
32.16 str2list() and list2str() Functions
We can convert string lines to list items using the str2list() function. Also we can convert the list to a string using
list2str() function.
Syntax:
str2list(string) ---> list contains the string lines
list2str(list) ---> string contains the list items
Example:
/* output:
** Items : 4
** Item : Hello
** Item : How are you ?
** Item : are you fine ?
** Item : ok
** list2Str result = Hello
** How are you ?
** are you fine ?
** ok
** Done
*/
32.15. strcmp() Function 275
Ring Documentation, Release 1.10
mystr = "Hello
How are you ?
are you fine ?
ok"
mylist = str2list(mystr)
see "Items : " + len(mylist) + nl
for x in mylist
see "Item : " + x + nl
next
newstr = list2str(mylist)
see "list2Str result = " + newstr
if mystr = newstr
see nl + "Done"
else
see nl + "Error!"
ok
32.17 Merge binary characters
From Ring 1.0 we can create binary strings and do operations on these strings.
Starting from Ring 1.8, we can get individual characters from these strings and merge them together using the ‘+’
operator.
Example:
cStr = "Welcome"
? cstr[1] + cstr[2] + cStr[5]
v = cstr[1] + cstr[2] + cStr[5]
? v
? len(v)
c1 = cStr[1]
? c1
aList = [1,2,3]
cStr = ""
for item in aList
cStr += int2bytes(item)
next
? "All String"
? len(cStr)
? "First Part"
n1 = cStr[1] + cStr[2] + cStr[3] + cStr[4]
? len(n1)
? "Second Part"
n2 = cStr[5] + cStr[6] + cStr[7] + cStr[8]
? len(n2)
? "Third Part"
n3 = cStr[9] + cStr[10] + cStr[11] + cStr[12]
? len(n3)
? "All String"
cString = cStr[1] + cStr[2] + cStr[3] + cStr[4] +
cStr[5] + cStr[6] + cStr[7] + cStr[8] +
cStr[9] + cStr[10] + cStr[11] + cStr[12]
32.17. Merge binary characters 276
Ring Documentation, Release 1.10
? len(cString)
? ascii(cStr[1])
? len(cStr[2])
Output:
Weo
Weo
3
W
All String
12
First Part
4
Second Part
4 }
Third Part
4
All String
12
1
1
32.17. Merge binary characters 277

More Related Content

What's hot

The Ring programming language version 1.2 book - Part 9 of 84
The Ring programming language version 1.2 book - Part 9 of 84The Ring programming language version 1.2 book - Part 9 of 84
The Ring programming language version 1.2 book - Part 9 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 30 of 210
The Ring programming language version 1.9 book - Part 30 of 210The Ring programming language version 1.9 book - Part 30 of 210
The Ring programming language version 1.9 book - Part 30 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 10 of 84
The Ring programming language version 1.2 book - Part 10 of 84The Ring programming language version 1.2 book - Part 10 of 84
The Ring programming language version 1.2 book - Part 10 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 28 of 212
The Ring programming language version 1.10 book - Part 28 of 212The Ring programming language version 1.10 book - Part 28 of 212
The Ring programming language version 1.10 book - Part 28 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 20 of 184
The Ring programming language version 1.5.3 book - Part 20 of 184The Ring programming language version 1.5.3 book - Part 20 of 184
The Ring programming language version 1.5.3 book - Part 20 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 13 of 84
The Ring programming language version 1.2 book - Part 13 of 84The Ring programming language version 1.2 book - Part 13 of 84
The Ring programming language version 1.2 book - Part 13 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181Mahmoud Samir Fayed
 
Go ahead, make my day
Go ahead, make my dayGo ahead, make my day
Go ahead, make my dayTor Ivry
 
The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181Mahmoud Samir Fayed
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークTsuyoshi Yamamoto
 
The Ring programming language version 1.4.1 book - Part 6 of 31
The Ring programming language version 1.4.1 book - Part 6 of 31The Ring programming language version 1.4.1 book - Part 6 of 31
The Ring programming language version 1.4.1 book - Part 6 of 31Mahmoud Samir Fayed
 

What's hot (20)

The Ring programming language version 1.2 book - Part 9 of 84
The Ring programming language version 1.2 book - Part 9 of 84The Ring programming language version 1.2 book - Part 9 of 84
The Ring programming language version 1.2 book - Part 9 of 84
 
The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.5.2 book - Part 22 of 181
 
The Ring programming language version 1.9 book - Part 30 of 210
The Ring programming language version 1.9 book - Part 30 of 210The Ring programming language version 1.9 book - Part 30 of 210
The Ring programming language version 1.9 book - Part 30 of 210
 
The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84
 
The Ring programming language version 1.2 book - Part 10 of 84
The Ring programming language version 1.2 book - Part 10 of 84The Ring programming language version 1.2 book - Part 10 of 84
The Ring programming language version 1.2 book - Part 10 of 84
 
The Ring programming language version 1.10 book - Part 28 of 212
The Ring programming language version 1.10 book - Part 28 of 212The Ring programming language version 1.10 book - Part 28 of 212
The Ring programming language version 1.10 book - Part 28 of 212
 
The Ring programming language version 1.5.3 book - Part 20 of 184
The Ring programming language version 1.5.3 book - Part 20 of 184The Ring programming language version 1.5.3 book - Part 20 of 184
The Ring programming language version 1.5.3 book - Part 20 of 184
 
The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
The Ring programming language version 1.2 book - Part 13 of 84
The Ring programming language version 1.2 book - Part 13 of 84The Ring programming language version 1.2 book - Part 13 of 84
The Ring programming language version 1.2 book - Part 13 of 84
 
The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88
 
はじめてのGroovy
はじめてのGroovyはじめてのGroovy
はじめてのGroovy
 
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.5.2 book - Part 26 of 181
 
Go ahead, make my day
Go ahead, make my dayGo ahead, make my day
Go ahead, make my day
 
The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク
 
The Ring programming language version 1.4.1 book - Part 6 of 31
The Ring programming language version 1.4.1 book - Part 6 of 31The Ring programming language version 1.4.1 book - Part 6 of 31
The Ring programming language version 1.4.1 book - Part 6 of 31
 

Similar to The Ring programming language version 1.10 book - Part 31 of 212

The Ring programming language version 1.8 book - Part 29 of 202
The Ring programming language version 1.8 book - Part 29 of 202The Ring programming language version 1.8 book - Part 29 of 202
The Ring programming language version 1.8 book - Part 29 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 31 of 210
The Ring programming language version 1.9 book - Part 31 of 210The Ring programming language version 1.9 book - Part 31 of 210
The Ring programming language version 1.9 book - Part 31 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 25 of 196
The Ring programming language version 1.7 book - Part 25 of 196The Ring programming language version 1.7 book - Part 25 of 196
The Ring programming language version 1.7 book - Part 25 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 22 of 189
The Ring programming language version 1.6 book - Part 22 of 189The Ring programming language version 1.6 book - Part 22 of 189
The Ring programming language version 1.6 book - Part 22 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 22 of 180
The Ring programming language version 1.5.1 book - Part 22 of 180The Ring programming language version 1.5.1 book - Part 22 of 180
The Ring programming language version 1.5.1 book - Part 22 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 5 of 30
The Ring programming language version 1.4 book - Part 5 of 30The Ring programming language version 1.4 book - Part 5 of 30
The Ring programming language version 1.4 book - Part 5 of 30Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 45 of 212
The Ring programming language version 1.10 book - Part 45 of 212The Ring programming language version 1.10 book - Part 45 of 212
The Ring programming language version 1.10 book - Part 45 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 27 of 196
The Ring programming language version 1.7 book - Part 27 of 196The Ring programming language version 1.7 book - Part 27 of 196
The Ring programming language version 1.7 book - Part 27 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 26 of 189
The Ring programming language version 1.6 book - Part 26 of 189The Ring programming language version 1.6 book - Part 26 of 189
The Ring programming language version 1.6 book - Part 26 of 189Mahmoud Samir Fayed
 
1-Object and Data Structures.pptx
1-Object and Data Structures.pptx1-Object and Data Structures.pptx
1-Object and Data Structures.pptxRobNieves1
 
The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 25 of 88
The Ring programming language version 1.3 book - Part 25 of 88The Ring programming language version 1.3 book - Part 25 of 88
The Ring programming language version 1.3 book - Part 25 of 88Mahmoud Samir Fayed
 
iRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat SheetiRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat SheetSamuel Lampa
 
The Ring programming language version 1.5.4 book - Part 24 of 185
The Ring programming language version 1.5.4 book - Part 24 of 185The Ring programming language version 1.5.4 book - Part 24 of 185
The Ring programming language version 1.5.4 book - Part 24 of 185Mahmoud Samir Fayed
 
13 Strings and Text Processing
13 Strings and Text Processing13 Strings and Text Processing
13 Strings and Text ProcessingIntro C# Book
 
The Ring programming language version 1.10 book - Part 32 of 212
The Ring programming language version 1.10 book - Part 32 of 212The Ring programming language version 1.10 book - Part 32 of 212
The Ring programming language version 1.10 book - Part 32 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 6 of 30
The Ring programming language version 1.4 book - Part 6 of 30The Ring programming language version 1.4 book - Part 6 of 30
The Ring programming language version 1.4 book - Part 6 of 30Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 179 of 185
The Ring programming language version 1.5.4 book - Part 179 of 185The Ring programming language version 1.5.4 book - Part 179 of 185
The Ring programming language version 1.5.4 book - Part 179 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 28 of 196
The Ring programming language version 1.7 book - Part 28 of 196The Ring programming language version 1.7 book - Part 28 of 196
The Ring programming language version 1.7 book - Part 28 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212Mahmoud Samir Fayed
 

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

The Ring programming language version 1.8 book - Part 29 of 202
The Ring programming language version 1.8 book - Part 29 of 202The Ring programming language version 1.8 book - Part 29 of 202
The Ring programming language version 1.8 book - Part 29 of 202
 
The Ring programming language version 1.9 book - Part 31 of 210
The Ring programming language version 1.9 book - Part 31 of 210The Ring programming language version 1.9 book - Part 31 of 210
The Ring programming language version 1.9 book - Part 31 of 210
 
The Ring programming language version 1.7 book - Part 25 of 196
The Ring programming language version 1.7 book - Part 25 of 196The Ring programming language version 1.7 book - Part 25 of 196
The Ring programming language version 1.7 book - Part 25 of 196
 
The Ring programming language version 1.6 book - Part 22 of 189
The Ring programming language version 1.6 book - Part 22 of 189The Ring programming language version 1.6 book - Part 22 of 189
The Ring programming language version 1.6 book - Part 22 of 189
 
The Ring programming language version 1.5.1 book - Part 22 of 180
The Ring programming language version 1.5.1 book - Part 22 of 180The Ring programming language version 1.5.1 book - Part 22 of 180
The Ring programming language version 1.5.1 book - Part 22 of 180
 
The Ring programming language version 1.4 book - Part 5 of 30
The Ring programming language version 1.4 book - Part 5 of 30The Ring programming language version 1.4 book - Part 5 of 30
The Ring programming language version 1.4 book - Part 5 of 30
 
The Ring programming language version 1.10 book - Part 45 of 212
The Ring programming language version 1.10 book - Part 45 of 212The Ring programming language version 1.10 book - Part 45 of 212
The Ring programming language version 1.10 book - Part 45 of 212
 
The Ring programming language version 1.7 book - Part 27 of 196
The Ring programming language version 1.7 book - Part 27 of 196The Ring programming language version 1.7 book - Part 27 of 196
The Ring programming language version 1.7 book - Part 27 of 196
 
The Ring programming language version 1.6 book - Part 26 of 189
The Ring programming language version 1.6 book - Part 26 of 189The Ring programming language version 1.6 book - Part 26 of 189
The Ring programming language version 1.6 book - Part 26 of 189
 
1-Object and Data Structures.pptx
1-Object and Data Structures.pptx1-Object and Data Structures.pptx
1-Object and Data Structures.pptx
 
The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189
 
The Ring programming language version 1.3 book - Part 25 of 88
The Ring programming language version 1.3 book - Part 25 of 88The Ring programming language version 1.3 book - Part 25 of 88
The Ring programming language version 1.3 book - Part 25 of 88
 
iRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat SheetiRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat Sheet
 
The Ring programming language version 1.5.4 book - Part 24 of 185
The Ring programming language version 1.5.4 book - Part 24 of 185The Ring programming language version 1.5.4 book - Part 24 of 185
The Ring programming language version 1.5.4 book - Part 24 of 185
 
13 Strings and Text Processing
13 Strings and Text Processing13 Strings and Text Processing
13 Strings and Text Processing
 
The Ring programming language version 1.10 book - Part 32 of 212
The Ring programming language version 1.10 book - Part 32 of 212The Ring programming language version 1.10 book - Part 32 of 212
The Ring programming language version 1.10 book - Part 32 of 212
 
The Ring programming language version 1.4 book - Part 6 of 30
The Ring programming language version 1.4 book - Part 6 of 30The Ring programming language version 1.4 book - Part 6 of 30
The Ring programming language version 1.4 book - Part 6 of 30
 
The Ring programming language version 1.5.4 book - Part 179 of 185
The Ring programming language version 1.5.4 book - Part 179 of 185The Ring programming language version 1.5.4 book - Part 179 of 185
The Ring programming language version 1.5.4 book - Part 179 of 185
 
The Ring programming language version 1.7 book - Part 28 of 196
The Ring programming language version 1.7 book - Part 28 of 196The Ring programming language version 1.7 book - Part 28 of 196
The Ring programming language version 1.7 book - Part 28 of 196
 
The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212
 

More from Mahmoud Samir Fayed

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

More from Mahmoud Samir Fayed (20)

The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212The Ring programming language version 1.10 book - Part 212 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 211 of 212The Ring programming language version 1.10 book - Part 211 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 210 of 212The Ring programming language version 1.10 book - Part 210 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 208 of 212The Ring programming language version 1.10 book - Part 208 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 207 of 212The Ring programming language version 1.10 book - Part 207 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 205 of 212The Ring programming language version 1.10 book - Part 205 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 206 of 212The Ring programming language version 1.10 book - Part 206 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 204 of 212The Ring programming language version 1.10 book - Part 204 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 203 of 212The Ring programming language version 1.10 book - Part 203 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 202 of 212The Ring programming language version 1.10 book - Part 202 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 201 of 212The Ring programming language version 1.10 book - Part 201 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 200 of 212The Ring programming language version 1.10 book - Part 200 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 199 of 212The Ring programming language version 1.10 book - Part 199 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 198 of 212The Ring programming language version 1.10 book - Part 198 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 197 of 212The Ring programming language version 1.10 book - Part 197 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 196 of 212The Ring programming language version 1.10 book - Part 196 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 195 of 212The Ring programming language version 1.10 book - Part 195 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 194 of 212The Ring programming language version 1.10 book - Part 194 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 193 of 212The Ring programming language version 1.10 book - Part 193 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
The Ring programming language version 1.10 book - Part 192 of 212The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212
 

Recently uploaded

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 

Recently uploaded (20)

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

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

  • 1. Ring Documentation, Release 1.10 myconnect ( [ :server = "myserver.com" , :port = 80 , :username = "mahmoud" , :password = "password" ] ) func myconnect mypara # print connection details see "User Name : " + mypara[:username] + nl + "Password : " + mypara[:password] + nl + "Server : " + mypara[:server] + nl + "Port : " + mypara[:port] 31.18 Passing Parameters or Argumnents Using List Array Passing Arguments or Parmameters to a Function in an array format Example: myList = [5,7,3,9] ### list with args or parms in an array result = sum(myList) See "Sum result: "+ result +n func sum(aList) acc = 0 sizeList = len(aList) for i = 1 to sizeList See aList[i] +nl acc = acc + aList[i] next return acc 31.19 Creating a Multi-Dimensional Array using List A Multi-Dimensional Array of any size can be built using recursion in a Function Example: ###--------------------------------------------------------- ### Create Array -- Dimensions Any Size: 3D, 4D, 5D etc dimList = [4,3,4] bList = createDimList(dimList) ###--------------------------------------------------------- ### Populate the arrays using a counter 1 , 4x4x4 = 256 , 2x3x4x5x6 = 720 Counter = 1 for Col=1 to dimList[1] for Row=1 to dimList[2] for Dep=1 to dimList[3] blist[Col][Row][Dep] = Counter Counter++ next next 31.18. Passing Parameters or Argumnents Using List Array 268
  • 2. Ring Documentation, Release 1.10 next ###----------------------------------------------- ### Print the array elements in block format for Col=1 to dimList[1] for Row=1 to dimList[2] for Dep=1 to dimList[3] See bList[Col][Row][Dep] See " " next See nl next See nl next ###=========================== ### FUNCTIONS ###----------------------------------------------------------------------- ### Recursive Create a Dimension Array ### Call by passing an array of dimesions: dimList = [2,3,4,5] ### Drop the first entry every iteration call, making newParms ### ### Example: ### dimList = [4,2,3,2] <<< Number and size of dimensions in array format ### bList = createDimList(dimList) <<< Call using the array as input func createDimList(dimArray) sizeList = len(dimArray) newParms = [] for i = 2 to sizeList Add(newParms, dimArray[i]) next alist = list(dimArray[1]) if sizeList = 1 return aList ok for t in alist t = createDimList(newParms) next return alist 31.20 Swap Items We can swap the list items using the Swap() function. Example: aList = [:one,:two,:four,:three] see aList 31.20. Swap Items 269
  • 3. Ring Documentation, Release 1.10 see copy("*",50) + nl swap(aList,3,4) see aList Output one two four three ************************************************** one two three four 31.20. Swap Items 270
  • 4. CHAPTER THIRTYTWO STRINGS In this chapter we are going to learn about strings creation and manipulation. 32.1 String Literals Syntax: cStr = "This is a string" cStr2 = 'Another string' cStr3 = :JustAnotherString cStr4 = `Yet "another" 'string' ! ` 32.2 Get String Length We can get the string length (letters count inside a string) using the len() function Syntax: len(string) ---> string length Example: cStr = "How are you?" see cStr + nl see "String size : " + len(cStr) + nl 32.3 Convert Letters Case Syntax: lower(string) ---> convert string letters to lower case upper(string) ---> convert string letters to UPPER case Example: cStr = "Welcome To The Ring Programming Language" see cStr + nl + upper(cStr) + nl + lower(cStr) 271
  • 5. Ring Documentation, Release 1.10 32.4 Access String Letters We can access a letter inside a string by the letter index Syntax: string[index] ---> get string letter string[index] = letter # set string letter Example: # print user name letter by letter (each letter in new line) See "Hello, Enter your name : " give cName for x = 1 to len(cName) see nl + cName[x] next We can use for in to get string letters. Example: # print user name letter by letter (each letter in new line) See "Hello, Enter your name : " give cName for x in cName see nl + x next We can modify the string letters Example: # convert the first letter to UPPER case See "Enter your name : " give cName cName[1] = upper(cName[1]) see "Hello " + cName 32.5 Left() Function We can get a specified number of characters from a string using the Left() function. The starting position is 1. Syntax: Left(string,count) Example: see left("Hello World!",5) # print Hello 32.6 Right() Function We can get a specified number of characters from a string using the Right() function. 32.4. Access String Letters 272
  • 6. Ring Documentation, Release 1.10 The starting position is the last character on the right. Syntax: Right(string,count) Example: see Right("Hello World!",6) # print World! 32.7 Trim() Function We can remove all leading and trailing spaces from a string using the Trim() function. Syntax: trim(string) Example: cMsg = " Welcome " see trim(cMsg) # print Welcome 32.8 Copy() Function We can duplicate a string more than one time using the copy() function. Syntax: copy(string,nCount) ---> string replicated nCount times Example see copy("***hello***",3) # print ***hello******hello******hello*** 32.9 Lines() Function We can count the number of lines inside a string using the Lines() function. Syntax: lines(string) ---> Number of lines inside the string Example: cStr = "Hello How are you? are you fine?" see lines(cStr) # print 3 32.7. Trim() Function 273
  • 7. Ring Documentation, Release 1.10 32.10 Substr() Function We can work on sub strings inside a string using the substr() function. Using Substr() we can • Find substring • Get substring from position to end • Get Number of characters from position • Transform Substring To Another Substring 32.11 Find substring Syntax: substr(string,substring) ---> the starting position of substring in string Example: cStr = "Welcome to the Ring programming language" see substr(cStr,"Ring") # print 16 32.12 Get substring from position to end Syntax: substr(string,position) ---> Get substring starting from position to end Example: cStr = "Welcome to the Ring programming language" nPos = substr(cStr,"Ring") # nPos = 16 see substr(cStr,nPos) # print Ring programming language 32.13 Get Number of Characters From Position Syntax: substr(string,position,count) ---> Get characters starting from position Example: cStr = "Welcome to the Ring programming language" nPos = substr(cStr,"Ring") # nPos = 16 see substr(cStr,nPos,4) # print Ring 32.14 Transform Substring To Another Substring Syntax: 32.10. Substr() Function 274
  • 8. Ring Documentation, Release 1.10 substr(string,substring,newsubstring) ---> Transformed string (Match case) substr(string,substring,newsubstring,1) ---> Transformed string (Ignore case) Example: cStr = "Welcome to the New programming language" see substr(cStr,"New","Ring") + nl # print Welcome to the Ring programming language see substr(cStr,"new","Ring",1)+ nl # print Welcome to the Ring programming language 32.15 strcmp() Function We can compare between two strings using the strcmp() function. Syntax: strcmp(cString1,cString2) ---> value = 0 if cString1 = cString2 value < 0 if cString1 < cString2 value > 0 if cString1 > cString2 Example: see strcmp("hello","hello") + nl + strcmp("abc","bcd") + nl + strcmp("bcd","abc") + nl Output: 0 -1 1 32.16 str2list() and list2str() Functions We can convert string lines to list items using the str2list() function. Also we can convert the list to a string using list2str() function. Syntax: str2list(string) ---> list contains the string lines list2str(list) ---> string contains the list items Example: /* output: ** Items : 4 ** Item : Hello ** Item : How are you ? ** Item : are you fine ? ** Item : ok ** list2Str result = Hello ** How are you ? ** are you fine ? ** ok ** Done */ 32.15. strcmp() Function 275
  • 9. Ring Documentation, Release 1.10 mystr = "Hello How are you ? are you fine ? ok" mylist = str2list(mystr) see "Items : " + len(mylist) + nl for x in mylist see "Item : " + x + nl next newstr = list2str(mylist) see "list2Str result = " + newstr if mystr = newstr see nl + "Done" else see nl + "Error!" ok 32.17 Merge binary characters From Ring 1.0 we can create binary strings and do operations on these strings. Starting from Ring 1.8, we can get individual characters from these strings and merge them together using the ‘+’ operator. Example: cStr = "Welcome" ? cstr[1] + cstr[2] + cStr[5] v = cstr[1] + cstr[2] + cStr[5] ? v ? len(v) c1 = cStr[1] ? c1 aList = [1,2,3] cStr = "" for item in aList cStr += int2bytes(item) next ? "All String" ? len(cStr) ? "First Part" n1 = cStr[1] + cStr[2] + cStr[3] + cStr[4] ? len(n1) ? "Second Part" n2 = cStr[5] + cStr[6] + cStr[7] + cStr[8] ? len(n2) ? "Third Part" n3 = cStr[9] + cStr[10] + cStr[11] + cStr[12] ? len(n3) ? "All String" cString = cStr[1] + cStr[2] + cStr[3] + cStr[4] + cStr[5] + cStr[6] + cStr[7] + cStr[8] + cStr[9] + cStr[10] + cStr[11] + cStr[12] 32.17. Merge binary characters 276
  • 10. Ring Documentation, Release 1.10 ? len(cString) ? ascii(cStr[1]) ? len(cStr[2]) Output: Weo Weo 3 W All String 12 First Part 4 Second Part 4 } Third Part 4 All String 12 1 1 32.17. Merge binary characters 277