SlideShare a Scribd company logo
Ring Documentation, Release 1.9
acolors: List...
white
blue
yellow
46.28 mergemethods() Function
We can share methods between classes without inheritance using the MergeMethods() function
This function merge class methods to another class.
Syntax:
MergeMethods(cClassNameDestination,cClassNameSource)
Example:
mergemethods("count","share")
mergemethods("count2","share")
o1 = new count { test() }
o1 = new count2 { test() }
Class Share
func one
see "one" + nl
func two
see "two" + nl
func three
see "three" + nl
Class Display
Func printline
see copy("*",20) + nl
Class Count from Display
Func test
printline()
one()
two()
three()
printline()
Class Count2 from Display
Func test
three()
two()
one()
printline()
Output:
********************
one
two
three
********************
46.28. mergemethods() Function 379
Ring Documentation, Release 1.9
three
two
one
********************
46.29 packagename() Function
We can know the package name of the latest sucessful import command using the packagename() function
Syntax:
packagename() --> Returns the package name of the latest sucessful import
Example:
load "weblib.ring"
import System.web
see packagename() # system.web
46.29. packagename() Function 380
CHAPTER
FORTYSEVEN
STDLIB FUNCTIONS
In this chapter we are going to learn about functions in the stdlib.ring
Before using the functions in the library, We must load the library first
load "stdlib.ring"
Instead of using stdlib.ring we can use stdlibcore.ring
Using stdlibcore.ring we can use the StdLib functions (Without Classes)
This is useful when developing standalone console applications
Because using stdlib.ring (functions & classes) will load libraries like RingLibCurl, RingOpenSSL, etc.
47.1 Puts() function
print the value then print new line (nl)
Syntax:
puts(expr)
Example:
Load "stdlib.ring"
Puts("Hello, World!")
47.2 Print() function
print string - support n,t and r
Also we can use #{variable_name} to insert variables values.
Syntax:
print(string) ---> String
Example:
print("nHello, WorldnnHow are you? tt I'm fine!n")
x=10 y=20
print("nx value = #{x} , y value = #{y} n")
381
Ring Documentation, Release 1.9
47.3 Print2Str() Function
Syntax:
print2Str(string) ---> String
Example:
world = "World!"
mystring = print2str("Hello, #{world} nIn Year n#{2000+17} n")
see mystring + nl
Output:
Hello, World!
In Year
2017
47.4 GetString() function
Get input from the keyboard - return value as string
getstring() ---> string
47.5 GetNumber() function
Get input from the keyboard - return value as number
getnumber() ---> number
47.6 AppPath() function
Get the path of the application folder
Syntax:
AppPath() ---> The path as String
Example:
Load "stdlib.ring"
# Application Path
Puts("Test AppPath()")
See AppPath() + nl
47.7 JustFilePath() function
Get the path of the file, remove the file name.
47.3. Print2Str() Function 382
Ring Documentation, Release 1.9
Syntax:
JustFilePath(cFile) ---> The path as String
Example:
load "stdlib.ring"
see justfilePath("b:ringapplicationsrnoternote.ring")
Output:
b:ringapplicationsrnote
47.8 JustFileName() function
Get the file, remove the file path.
Syntax:
JustFileName(cFile) ---> The file name as String
Example:
load "stdlib.ring"
see justfileName("b:ringapplicationsrnoternote.ring")
Output:
rnote.ring
47.9 Value() function
create a copy from a list or object
Syntax:
value(List) ---> new list
Example:
Load "stdlib.ring"
aList = 1:10
del(value(aList),1) # delete first item
see aList # print numbers from 1 to 10
47.10 Times() function
Execute a Function nCount times
Syntax:
47.8. JustFileName() function 383
Ring Documentation, Release 1.9
Times(nCount,function)
Example:
Load "stdlib.ring"
Puts("Test Times()")
Times ( 3 , func { see "Hello, World!" + nl } )
47.11 Map() function
Execute a Function on each list item
Syntax:
Map(alist,function) ---> List
Example:
Load "stdlib.ring"
Puts("Test Map()")
See Map( 1:10, func x { return x*x } )
47.12 Filter() function
Execute a Function on each list item to filter items
Syntax:
Filter(alist,function) ---> List
Example:
Load "stdlib.ring"
Puts("Test Filter()")
See Filter( 1:10 , func x { if x <= 5 return true else return false ok } )
47.13 Split() function
Convert string words to list items
Syntax:
Split(cstring,delimiter) ---> List
Example:
Load "stdlib.ring"
Puts("Test Split()")
See Split("one two three four five"," ")
47.11. Map() function 384
Ring Documentation, Release 1.9
47.14 SplitMany() function
Convert string words to list items. Allow many delimiters.
Syntax:
SplitMany(cstring,delimiters as string or list) --> List
Example:
Load "stdlib.ring"
Puts("Test SplitMany()")
See SplitMany("one,two,three,four and five"," ,")
47.15 NewList() function
Create a two dimensional list
Syntax:
NewList(nRows,nColumns) ---> new list
Example:
Load "stdlib.ring"
Puts("Test Newlist()")
a1 = 3
a2 = 5
chrArray = newlist(a1,a2)
numArray = newlist(a1,a2)
chrArray[1][1] = "Hello"
numArray[1][1] = 987.2
See chrArray[1][1] + nl
See numArray[1][1] + nl
47.16 Capitalized() function
Return a copy of a string with the first letter capitalized
Syntax:
Capitalized(string) ---> string
Example:
Load "stdlib.ring"
Puts("Test Capitalized()")
See capitalized("welcome to the Ring Programming Language")
47.14. SplitMany() function 385
Ring Documentation, Release 1.9
47.17 IsSpecial() function
Check whether a character is special or not
Syntax:
IsSpecial(char) ---> True/False
Example:
Load "stdlib.ring"
Puts("Test Isspecial()")
See "Isspecial = " + isSpecial("%") + nl
47.18 IsVowel() function
Check whether a character is vowel or not
Syntax:
IsVowel(char) ---> True/False
Example:
Load "stdlib.ring"
Puts("Test Isvowel()")
See "Isvowel = " + isVowel("c") + nl
47.19 LineCount() function
Return the lines count in a text file.
Syntax:
LineCount(cFileName) ---> Lines Count as number
Example:
Load "stdlib.ring"
Puts("Test Linecount()")
See "the number of lines = " + lineCount("test.ring")
47.20 Factorial() function
Return the factorial of a number
Syntax:
Factorial(number) ---> number
Example:
47.17. IsSpecial() function 386
Ring Documentation, Release 1.9
Load "stdlib.ring"
Puts("Test Factorial()")
see "6 factorial is : " + Factorial(6)
47.21 Fibonacci() function
Return the fibonacci number
Syntax:
Fibonacci(number) ---> number
Example:
Load "stdlib.ring"
Puts("Test Fibonacci()")
see "6 Fibonacci is : " + Fibonacci(6)
47.22 IsPrime() function
Check whether a number is prime or not
Syntax:
isprime(number) ---> Number
Example:
Load "stdlib.ring"
Puts("Test Isprime()")
if isPrime(16) see "16 is a prime number"
else see "16 is not a prime number" ok
47.23 Sign() function
Returns an integer value indicating the sign of a number.
Syntax:
Sign(number) ---> number ( -1 = negative , 0 , 1 (positive) )
Example:
Load "stdlib.ring"
Puts("Test Sign()")
see "sign of 12 is = " + sign(12) + nl
47.21. Fibonacci() function 387
Ring Documentation, Release 1.9
47.24 List2File() function
Write list items to text file (each item in new line).
Syntax:
List2File(aList,cFileName)
Example:
Load "stdlib.ring"
# Test List2File
Puts("Test List2File()")
list2file(1:100,"myfile.txt")
47.25 File2List() function
Read text file and convert lines to list items
Syntax:
File2List(cFileName) ---> List
Example:
Load "stdlib.ring"
# Test File2List
Puts("Test File2List()")
see len(file2list("myfile.txt"))
47.26 StartsWith() function
Returns true if the given string starts with the specified substring.
Leading white spaces are ignored.
Syntax:
StartsWith(string, substring) ---> True/False
Example:
Load "stdlib.ring"
Puts("Test Startswith()")
see Startswith("CalmoSoft", "Calmo") + nl
47.27 EndsWith() function
Returns true if the given string ends with the specified substring.
Trailing white spaces are ignored.
47.24. List2File() function 388

More Related Content

PDF
The Ring programming language version 1.5.1 book - Part 32 of 180
PDF
The Ring programming language version 1.10 book - Part 43 of 212
PDF
The Ring programming language version 1.5.1 book - Part 33 of 180
PDF
The Ring programming language version 1.2 book - Part 23 of 84
PDF
The Ring programming language version 1.5.2 book - Part 33 of 181
PDF
The Ring programming language version 1.7 book - Part 37 of 196
PDF
The Ring programming language version 1.5.4 book - Part 34 of 185
PDF
The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.5.1 book - Part 32 of 180
The Ring programming language version 1.10 book - Part 43 of 212
The Ring programming language version 1.5.1 book - Part 33 of 180
The Ring programming language version 1.2 book - Part 23 of 84
The Ring programming language version 1.5.2 book - Part 33 of 181
The Ring programming language version 1.7 book - Part 37 of 196
The Ring programming language version 1.5.4 book - Part 34 of 185
The Ring programming language version 1.2 book - Part 24 of 84

What's hot (20)

PDF
The Ring programming language version 1.6 book - Part 35 of 189
PDF
The Ring programming language version 1.9 book - Part 43 of 210
PDF
The Ring programming language version 1.3 book - Part 83 of 88
PDF
The Ring programming language version 1.6 book - Part 183 of 189
PDF
The Ring programming language version 1.5.2 book - Part 31 of 181
PDF
The Ring programming language version 1.5.2 book - Part 34 of 181
PDF
The Ring programming language version 1.5.3 book - Part 33 of 184
PDF
The Ring programming language version 1.6 book - Part 37 of 189
PDF
The Ring programming language version 1.8 book - Part 94 of 202
PPT
Oop lecture9 13
PDF
The Ring programming language version 1.8 book - Part 39 of 202
PDF
JDD 2016 - Pawel Byszewski - Kotlin, why?
PDF
The Ring programming language version 1.6 book - Part 36 of 189
PDF
The Ring programming language version 1.5.4 book - Part 22 of 185
PDF
The Ring programming language version 1.5.1 book - Part 36 of 180
PDF
The Ring programming language version 1.9 book - Part 34 of 210
PDF
The Ring programming language version 1.8 book - Part 43 of 202
PPTX
Poor Man's Functional Programming
KEY
関数潮流(Function Tendency)
PDF
Refactoring to Macros with Clojure
The Ring programming language version 1.6 book - Part 35 of 189
The Ring programming language version 1.9 book - Part 43 of 210
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.5.2 book - Part 31 of 181
The Ring programming language version 1.5.2 book - Part 34 of 181
The Ring programming language version 1.5.3 book - Part 33 of 184
The Ring programming language version 1.6 book - Part 37 of 189
The Ring programming language version 1.8 book - Part 94 of 202
Oop lecture9 13
The Ring programming language version 1.8 book - Part 39 of 202
JDD 2016 - Pawel Byszewski - Kotlin, why?
The Ring programming language version 1.6 book - Part 36 of 189
The Ring programming language version 1.5.4 book - Part 22 of 185
The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.9 book - Part 34 of 210
The Ring programming language version 1.8 book - Part 43 of 202
Poor Man's Functional Programming
関数潮流(Function Tendency)
Refactoring to Macros with Clojure
Ad

Similar to The Ring programming language version 1.9 book - Part 42 of 210 (20)

PDF
The Ring programming language version 1.3 book - Part 25 of 88
PDF
The Ring programming language version 1.8 book - Part 40 of 202
PDF
The Ring programming language version 1.5.3 book - Part 34 of 184
PDF
The Ring programming language version 1.10 book - Part 35 of 212
PDF
The Ring programming language version 1.10 book - Part 44 of 212
PDF
The Ring programming language version 1.5.4 book - Part 35 of 185
PDF
The Ring programming language version 1.7 book - Part 30 of 196
PDF
The Ring programming language version 1.2 book - Part 16 of 84
PDF
The Ring programming language version 1.4 book - Part 9 of 30
PDF
The Ring programming language version 1.5.2 book - Part 26 of 181
PDF
The Ring programming language version 1.3 book - Part 26 of 88
PDF
The Ring programming language version 1.7 book - Part 39 of 196
PDF
The Ring programming language version 1.7 book - Part 38 of 196
PDF
The Ring programming language version 1.5.2 book - Part 35 of 181
PDF
The Ring programming language version 1.3 book - Part 24 of 88
PDF
The Ring programming language version 1.5.4 book - Part 33 of 185
PDF
The Ring programming language version 1.10 book - Part 45 of 212
PDF
The Ring programming language version 1.9 book - Part 33 of 210
PDF
The Ring programming language version 1.5.3 book - Part 35 of 184
PDF
The Ring programming language version 1.4.1 book - Part 7 of 31
The Ring programming language version 1.3 book - Part 25 of 88
The Ring programming language version 1.8 book - Part 40 of 202
The Ring programming language version 1.5.3 book - Part 34 of 184
The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 44 of 212
The Ring programming language version 1.5.4 book - Part 35 of 185
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.2 book - Part 16 of 84
The Ring programming language version 1.4 book - Part 9 of 30
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.3 book - Part 26 of 88
The Ring programming language version 1.7 book - Part 39 of 196
The Ring programming language version 1.7 book - Part 38 of 196
The Ring programming language version 1.5.2 book - Part 35 of 181
The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.10 book - Part 45 of 212
The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.5.3 book - Part 35 of 184
The Ring programming language version 1.4.1 book - Part 7 of 31
Ad

More from Mahmoud Samir Fayed (20)

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

Recently uploaded (20)

PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
AI in Product Development-omnex systems
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
System and Network Administraation Chapter 3
PPTX
Transform Your Business with a Software ERP System
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Introduction to Artificial Intelligence
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Nekopoi APK 2025 free lastest update
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
AI in Product Development-omnex systems
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
System and Network Administraation Chapter 3
Transform Your Business with a Software ERP System
How to Migrate SBCGlobal Email to Yahoo Easily
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Introduction to Artificial Intelligence
Navsoft: AI-Powered Business Solutions & Custom Software Development
How Creative Agencies Leverage Project Management Software.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Wondershare Filmora 15 Crack With Activation Key [2025
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Operating system designcfffgfgggggggvggggggggg
Nekopoi APK 2025 free lastest update
Odoo Companies in India – Driving Business Transformation.pdf
CHAPTER 2 - PM Management and IT Context

The Ring programming language version 1.9 book - Part 42 of 210

  • 1. Ring Documentation, Release 1.9 acolors: List... white blue yellow 46.28 mergemethods() Function We can share methods between classes without inheritance using the MergeMethods() function This function merge class methods to another class. Syntax: MergeMethods(cClassNameDestination,cClassNameSource) Example: mergemethods("count","share") mergemethods("count2","share") o1 = new count { test() } o1 = new count2 { test() } Class Share func one see "one" + nl func two see "two" + nl func three see "three" + nl Class Display Func printline see copy("*",20) + nl Class Count from Display Func test printline() one() two() three() printline() Class Count2 from Display Func test three() two() one() printline() Output: ******************** one two three ******************** 46.28. mergemethods() Function 379
  • 2. Ring Documentation, Release 1.9 three two one ******************** 46.29 packagename() Function We can know the package name of the latest sucessful import command using the packagename() function Syntax: packagename() --> Returns the package name of the latest sucessful import Example: load "weblib.ring" import System.web see packagename() # system.web 46.29. packagename() Function 380
  • 3. CHAPTER FORTYSEVEN STDLIB FUNCTIONS In this chapter we are going to learn about functions in the stdlib.ring Before using the functions in the library, We must load the library first load "stdlib.ring" Instead of using stdlib.ring we can use stdlibcore.ring Using stdlibcore.ring we can use the StdLib functions (Without Classes) This is useful when developing standalone console applications Because using stdlib.ring (functions & classes) will load libraries like RingLibCurl, RingOpenSSL, etc. 47.1 Puts() function print the value then print new line (nl) Syntax: puts(expr) Example: Load "stdlib.ring" Puts("Hello, World!") 47.2 Print() function print string - support n,t and r Also we can use #{variable_name} to insert variables values. Syntax: print(string) ---> String Example: print("nHello, WorldnnHow are you? tt I'm fine!n") x=10 y=20 print("nx value = #{x} , y value = #{y} n") 381
  • 4. Ring Documentation, Release 1.9 47.3 Print2Str() Function Syntax: print2Str(string) ---> String Example: world = "World!" mystring = print2str("Hello, #{world} nIn Year n#{2000+17} n") see mystring + nl Output: Hello, World! In Year 2017 47.4 GetString() function Get input from the keyboard - return value as string getstring() ---> string 47.5 GetNumber() function Get input from the keyboard - return value as number getnumber() ---> number 47.6 AppPath() function Get the path of the application folder Syntax: AppPath() ---> The path as String Example: Load "stdlib.ring" # Application Path Puts("Test AppPath()") See AppPath() + nl 47.7 JustFilePath() function Get the path of the file, remove the file name. 47.3. Print2Str() Function 382
  • 5. Ring Documentation, Release 1.9 Syntax: JustFilePath(cFile) ---> The path as String Example: load "stdlib.ring" see justfilePath("b:ringapplicationsrnoternote.ring") Output: b:ringapplicationsrnote 47.8 JustFileName() function Get the file, remove the file path. Syntax: JustFileName(cFile) ---> The file name as String Example: load "stdlib.ring" see justfileName("b:ringapplicationsrnoternote.ring") Output: rnote.ring 47.9 Value() function create a copy from a list or object Syntax: value(List) ---> new list Example: Load "stdlib.ring" aList = 1:10 del(value(aList),1) # delete first item see aList # print numbers from 1 to 10 47.10 Times() function Execute a Function nCount times Syntax: 47.8. JustFileName() function 383
  • 6. Ring Documentation, Release 1.9 Times(nCount,function) Example: Load "stdlib.ring" Puts("Test Times()") Times ( 3 , func { see "Hello, World!" + nl } ) 47.11 Map() function Execute a Function on each list item Syntax: Map(alist,function) ---> List Example: Load "stdlib.ring" Puts("Test Map()") See Map( 1:10, func x { return x*x } ) 47.12 Filter() function Execute a Function on each list item to filter items Syntax: Filter(alist,function) ---> List Example: Load "stdlib.ring" Puts("Test Filter()") See Filter( 1:10 , func x { if x <= 5 return true else return false ok } ) 47.13 Split() function Convert string words to list items Syntax: Split(cstring,delimiter) ---> List Example: Load "stdlib.ring" Puts("Test Split()") See Split("one two three four five"," ") 47.11. Map() function 384
  • 7. Ring Documentation, Release 1.9 47.14 SplitMany() function Convert string words to list items. Allow many delimiters. Syntax: SplitMany(cstring,delimiters as string or list) --> List Example: Load "stdlib.ring" Puts("Test SplitMany()") See SplitMany("one,two,three,four and five"," ,") 47.15 NewList() function Create a two dimensional list Syntax: NewList(nRows,nColumns) ---> new list Example: Load "stdlib.ring" Puts("Test Newlist()") a1 = 3 a2 = 5 chrArray = newlist(a1,a2) numArray = newlist(a1,a2) chrArray[1][1] = "Hello" numArray[1][1] = 987.2 See chrArray[1][1] + nl See numArray[1][1] + nl 47.16 Capitalized() function Return a copy of a string with the first letter capitalized Syntax: Capitalized(string) ---> string Example: Load "stdlib.ring" Puts("Test Capitalized()") See capitalized("welcome to the Ring Programming Language") 47.14. SplitMany() function 385
  • 8. Ring Documentation, Release 1.9 47.17 IsSpecial() function Check whether a character is special or not Syntax: IsSpecial(char) ---> True/False Example: Load "stdlib.ring" Puts("Test Isspecial()") See "Isspecial = " + isSpecial("%") + nl 47.18 IsVowel() function Check whether a character is vowel or not Syntax: IsVowel(char) ---> True/False Example: Load "stdlib.ring" Puts("Test Isvowel()") See "Isvowel = " + isVowel("c") + nl 47.19 LineCount() function Return the lines count in a text file. Syntax: LineCount(cFileName) ---> Lines Count as number Example: Load "stdlib.ring" Puts("Test Linecount()") See "the number of lines = " + lineCount("test.ring") 47.20 Factorial() function Return the factorial of a number Syntax: Factorial(number) ---> number Example: 47.17. IsSpecial() function 386
  • 9. Ring Documentation, Release 1.9 Load "stdlib.ring" Puts("Test Factorial()") see "6 factorial is : " + Factorial(6) 47.21 Fibonacci() function Return the fibonacci number Syntax: Fibonacci(number) ---> number Example: Load "stdlib.ring" Puts("Test Fibonacci()") see "6 Fibonacci is : " + Fibonacci(6) 47.22 IsPrime() function Check whether a number is prime or not Syntax: isprime(number) ---> Number Example: Load "stdlib.ring" Puts("Test Isprime()") if isPrime(16) see "16 is a prime number" else see "16 is not a prime number" ok 47.23 Sign() function Returns an integer value indicating the sign of a number. Syntax: Sign(number) ---> number ( -1 = negative , 0 , 1 (positive) ) Example: Load "stdlib.ring" Puts("Test Sign()") see "sign of 12 is = " + sign(12) + nl 47.21. Fibonacci() function 387
  • 10. Ring Documentation, Release 1.9 47.24 List2File() function Write list items to text file (each item in new line). Syntax: List2File(aList,cFileName) Example: Load "stdlib.ring" # Test List2File Puts("Test List2File()") list2file(1:100,"myfile.txt") 47.25 File2List() function Read text file and convert lines to list items Syntax: File2List(cFileName) ---> List Example: Load "stdlib.ring" # Test File2List Puts("Test File2List()") see len(file2list("myfile.txt")) 47.26 StartsWith() function Returns true if the given string starts with the specified substring. Leading white spaces are ignored. Syntax: StartsWith(string, substring) ---> True/False Example: Load "stdlib.ring" Puts("Test Startswith()") see Startswith("CalmoSoft", "Calmo") + nl 47.27 EndsWith() function Returns true if the given string ends with the specified substring. Trailing white spaces are ignored. 47.24. List2File() function 388