Project

General

Profile

OpenSpace3D libs
OpenSpace 3D libraries for plugITs and OS3D developer

Functions

 isSmaller (s, t)
 Test if a string is smaller than an another string. More...
 
 isLarger (s, t)
 Test if a string is larger than an another string. More...
 
 suppDoublon (s1, s2)
 Test if a string is equal to an another string. More...
 
 suppDoublonCaseSensivity (s1, s2)
 Test if a string is equal to an another string case sensivity. More...
 
 getBooleanFromString (str)
 Get the boolean value of a string. More...
 
 isLastWordfromString (word, string)
 Compare the last word of a string. More...
 
 isFirstWordfromString (word, string)
 Compare the first word of a string. More...
 
 strreplaceChar (s, from, to)
 Replace a string in an another string. More...
 
 strreplace (s, from, to)
 Replace a string in an another string. More...
 
 strreplacei (s, from, to)
 Replace a string in an another string, case insensivity. More...
 
 strToWordList (s)
 convert a string to a list of words More...
 
 replaceByKeyIndex (s, key, args)
 replace key by value position in arg list ("my string is $1 with $2" "val1"::"val2"::nil) More...
 
 replaceByKeyIndex2 (s, key, args)
 replace key by value position in arg list ("my string is $1 with $2" "val1 val2") More...
 
 strcatnSep (l, sep)
 Concat a string list with a defined separator. More...
 
 strcatnlSep (l, sep)
 Concat a string list with a defined separator and a line feed. More...
 
 addSlashes (s)
 Protect special character with a '\'. More...
 
 stripSlashes (s)
 Remove special character protection '\'. More...
 
 strTruncate (s, maxlen, rp)
 Truncate a string. More...
 
 strQuote (s, q)
 Quote a string. More...
 
 listQuote (l, q)
 Quote a string list. More...
 
 strToList (s)
 Convert a String to a list of lines. More...
 
 oneLineTransform (s, sep)
 Change the line separation character. More...
 
 strToListSep (s, sep)
 Convert a string to a list by a defined separator. More...
 
 strbuildn (l)
 Convert list of words and lines to a string. More...
 
 listToString (l)
 Convert list of words and lines to a string. More...
 
 getNextToValue (cont, keyword)
 get the line after a keyword, for example "KEYWORD value" More...
 

Detailed Description

String tools

Function Documentation

◆ isSmaller()

isSmaller ( ,
 
)

Test if a string is smaller than an another string.

Use with quicksort function

Prototype: fun [S S] I

Parameters
S: first string to test
S: second string to test
Returns
I : 1 if smaller 0 otherwise

◆ isLarger()

isLarger ( ,
 
)

Test if a string is larger than an another string.

Use with quicksort function 0 Prototype: fun [S S] I

Parameters
S: first string to test
S: second string to test
Returns
I : superior to 0 if larger

◆ suppDoublon()

suppDoublon ( s1  ,
s2   
)

Test if a string is equal to an another string.

Use with quicksort function

Prototype: fun [S S] I

Parameters
S: first string to test
S: second string to test
Returns
I : different to 0 if not equal

◆ suppDoublonCaseSensivity()

suppDoublonCaseSensivity ( s1  ,
s2   
)

Test if a string is equal to an another string case sensivity.

Use with quicksort function

Prototype: fun [S S] I

Parameters
S: first string to test
S: second string to test
Returns
I : different to 0 if not equal

◆ getBooleanFromString()

getBooleanFromString ( str  )

Get the boolean value of a string.

Prototype: fun [S] I

Parameters
S: the boolean value "enable" "1" "on" "true" "yes"
Returns
I : 1 if the boolean value is correct, 0 otherwise

◆ isLastWordfromString()

isLastWordfromString ( word  ,
string   
)

Compare the last word of a string.

Prototype: fun [S S] I

Parameters
S: the word to compare
S: the full string
Returns
I : 1 if the word is at the end of the string, 0 otherwise

◆ isFirstWordfromString()

isFirstWordfromString ( word  ,
string   
)

Compare the first word of a string.

Prototype: fun [S S] I

Parameters
S: the word to compare
S: the full string
Returns
I : 1 if the word is at the beginning of the string, 0 otherwise

◆ strreplaceChar()

strreplaceChar ( ,
from  ,
to   
)

Replace a string in an another string.

Prototype: fun [S S S] S

Parameters
S: the string to change
I: char to find
S: the string to replace with
Returns
S : the new string

◆ strreplace()

strreplace ( ,
from  ,
to   
)

Replace a string in an another string.

Prototype: fun [S S S] S

Parameters
S: the string to change
S: the string to find
S: the string to replace with
Returns
S : the new string

◆ strreplacei()

strreplacei ( ,
from  ,
to   
)

Replace a string in an another string, case insensivity.

Prototype: fun [S S S] S

Parameters
S: the string to change
S: the string to find
S: the string to replace with
Returns
S : the new string

◆ strToWordList()

strToWordList ( )

convert a string to a list of words

Prototype: fun [S] [S r1]

Parameters
S: string
Returns
[S r1] : the list of words

◆ replaceByKeyIndex()

replaceByKeyIndex ( ,
key  ,
args   
)

replace key by value position in arg list ("my string is $1 with $2" "val1"::"val2"::nil)

Prototype: fun [S S [S r1]] S

Parameters
S: string
S: the key "$" for example
[Sr1] : list of arguments
Returns
S : the converted string

◆ replaceByKeyIndex2()

replaceByKeyIndex2 ( ,
key  ,
args   
)

replace key by value position in arg list ("my string is $1 with $2" "val1 val2")

Prototype: fun [S S S] S

Parameters
S: string
S: the key "$" for example
S: arguments
Returns
S : the converted string

◆ strcatnSep()

strcatnSep ( ,
sep   
)

Concat a string list with a defined separator.

Prototype: fun [[S r1] S] S

Parameters
[Sr1] : the string list
S: the separator to use
Returns
S : the new string

◆ strcatnlSep()

strcatnlSep ( ,
sep   
)

Concat a string list with a defined separator and a line feed.

Prototype: fun [[[S r1] r1] S] S

Parameters
[[Sr1] r1] : the string list
S: the separator to use
Returns
S : the new string

◆ addSlashes()

addSlashes ( )

Protect special character with a '\'.

Prototype: fun [S] S

Parameters
S: the string to protect
Returns
S : the new string

◆ stripSlashes()

stripSlashes ( )

Remove special character protection '\'.

Prototype: fun [S] S

Parameters
S: the string
Returns
S : the new string

◆ strTruncate()

strTruncate ( ,
maxlen  ,
rp   
)

Truncate a string.

Prototype: fun [S I S] S

Parameters
S: the string
I: the maximun string length
S: the string to add to the end (...)
Returns
S : the new string

◆ strQuote()

strQuote ( ,
 
)

Quote a string.

Prototype: fun [S S] S

Parameters
S: the string
S: the character to use for quotes '"'
Returns
S : the new string

◆ listQuote()

listQuote ( ,
 
)

Quote a string list.

Prototype: fun [[S r1] S] [S r1]

Parameters
[Sr1] : the string list
S: the character to use for quotes '"'
Returns
[S r1] : the new string list

◆ strToList()

strToList ( )

Convert a String to a list of lines.

Prototype: fun [S] [S r1]

Parameters
S: the string
Returns
[S r1] : the list of string lines

◆ oneLineTransform()

oneLineTransform ( ,
sep   
)

Change the line separation character.

Prototype: fun [S S] S

Parameters
S: the string
S: the line separation character
Returns
S : the new string

◆ strToListSep()

strToListSep ( ,
sep   
)

Convert a string to a list by a defined separator.

Prototype: fun [S S] [S r1]

Parameters
S: the string
S: separator ';'
Returns
[S r1] : the string list

◆ strbuildn()

strbuildn ( )

Convert list of words and lines to a string.

Prototype: fun [[[S r1] r1]] S

Parameters
[[Sr1] r1] : list of words and lines
Returns
S : the formated string

◆ listToString()

listToString ( )

Convert list of words and lines to a string.

Prototype: fun [[[S r1] r1]] S

Parameters
[[Sr1] r1] : list of words and lines
Returns
S : the formated string

◆ getNextToValue()

getNextToValue ( cont  ,
keyword   
)

get the line after a keyword, for example "KEYWORD value"

Prototype: fun [S S] S

Parameters
S: string
S: keyword
Returns
S : the value if the keyword exist nil otherwise