Project

General

Profile

OpenSpace3D libs
OpenSpace 3D libraries for plugITs and OS3D developer
Loading...
Searching...
No Matches

Functions

 isSmaller (s, t)
 Test if a string is smaller than another string.
 
 isLarger (s, t)
 Test if a string is larger than another string.
 
 suppDoublon (s1, s2)
 Test if a string is equal to another string.
 
 suppDoublonCaseSensivity (s1, s2)
 Test if a string is equal to another string case sensivity.
 
 getBooleanFromString (str)
 Get the boolean value of a string.
 
 isLastWordfromString (word, string)
 Compare the last word of a string.
 
 isFirstWordfromString (word, string)
 Compare the first word of a string.
 
 capitalizeFirstLetter (s)
 Make the first letter uppercase.
 
 strreplaceChar (s, from, to)
 Replace a string in an another string.
 
 strreplace (s, from, to)
 Replace a string in an another string.
 
 strreplacei (s, from, to)
 Replace a string in an another string, case insensivity.
 
 strToWordList (s)
 convert a string to a list of words
 
 replaceByKeyIndex (s, key, args)
 replace key by value position in arg list ("my string is $1 with $2" "val1"::"val2"::nil)
 
 replaceByKeyIndex2 (s, key, args)
 replace key by value position in arg list ("my string is $1 with $2" "val1 val2")
 
 strcatnSep (l, sep)
 Concat a string list with a defined separator.
 
 strcatnSepLimits (l, sep, nb)
 Concat a string list with a defined separator and limits.
 
 strcatnlSep (l, sep)
 Concat a string list with a defined separator and a line feed.
 
 addSlashes (s)
 Protect special character with a '\'.
 
 stripSlashes (s)
 Remove special character protection '\'.
 
 addChar (s, p, c)
 Protect char character with a char.
 
 stripChar (s, c)
 Remove special character protection '\'.
 
 strTruncate (s, maxlen, rp)
 Truncate a string.
 
 strQuote (s, q)
 Quote a string.
 
 listQuote (l, q)
 Quote a string list.
 
 strtrimChar (str, first, last)
 Remove spaces and first / last character of a string.
 
 strToList (s)
 Convert a String to a list of lines.
 
 strToQuotedList (s, c)
 Convert a String to a list of lines but protect line with char.
 
 oneLineTransform (s, sep)
 Change the line separation character.
 
 strToListSep (s, sep)
 Convert a string to a list by a defined separator.
 
 strToListOpenCloseSep (s, osep, csep)
 Convert a string to a list by a defined open / close separators.
 
 strToListSepCb (s, sep, cb)
 Convert a string to a list by a defined separator.
 
 strbuildn (l)
 Convert list of words and lines to a string.
 
 listToString (l)
 Convert list of lines to a string.
 
 isNumber (s)
 Check is a string is a number or a float.
 
 getNextToValue (cont, keyword)
 get the line after a keyword, for example "KEYWORD value"
 
 floatToString (float)
 transform a float into a clean readable string
 
 switchstrInv (l, s)
 invert switchstr parameter
 
 switchstriInv (l, s)
 invert switchstri parameter
 
 switchInv (l, s)
 invert switch parameter
 

Detailed Description

String tools

Function Documentation

◆ isSmaller()

isSmaller ( ,
 
)

Test if a string is smaller than 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 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 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 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

◆ capitalizeFirstLetter()

capitalizeFirstLetter ( )

Make the first letter uppercase.

Prototype: fun [S] S

Parameters
S: the text
Returns
S : The text with first letter uppercase

◆ 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

◆ strcatnSepLimits()

strcatnSepLimits ( ,
sep  ,
nb   
)

Concat a string list with a defined separator and limits.

Prototype: fun [[S r1] S I] 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

◆ addChar()

addChar ( ,
,
 
)

Protect char character with a char.

Prototype: fun [S I I] S

Parameters
S: the string to protect
I: char to protect
I: char to add
Returns
S : the new string

◆ stripChar()

stripChar ( ,
 
)

Remove special character protection '\'.

Prototype: fun [S I] S

Parameters
S: the string
I: char to remove
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

◆ strtrimChar()

strtrimChar ( str  ,
first  ,
last   
)

Remove spaces and first / last character of a string.

Prototype: fun [S S S] S

Parameters
S: the string
S: the first character to remove
S: the last character to remove
Returns
S : the new string

◆ 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

◆ strToQuotedList()

strToQuotedList ( ,
 
)

Convert a String to a list of lines but protect line with char.

Prototype: fun [S I] [S r1]

Parameters
S: the string
I: char condition
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

◆ strToListOpenCloseSep()

strToListOpenCloseSep ( ,
osep  ,
csep   
)

Convert a string to a list by a defined open / close separators.

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

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

◆ strToListSepCb()

strToListSepCb ( ,
sep  ,
cb   
)

Convert a string to a list by a defined separator.

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

Parameters
S: the string
S: separator ';'
fun[S] S : callback to modify the value
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 lines to a string.

Prototype: fun [[S r1]] S

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

◆ isNumber()

isNumber ( )

Check is a string is a number or a float.

Prototype: fun [S] I

Parameters
S: string
Returns
I : return 1 if the string is a number else 0

◆ 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

◆ floatToString()

floatToString ( float  )

transform a float into a clean readable string

Prototype: fun [F] S

Parameters
F: float value
Returns
S : the value cleaned float string

◆ switchstrInv()

switchstrInv ( ,
 
)

invert switchstr parameter

Prototype: fun [[u0 S] S] u0

Parameters
[u0S] : list
S: value to get
Returns
u0 : corresponding value

◆ switchstriInv()

switchstriInv ( ,
 
)

invert switchstri parameter

Prototype: fun [[u0 S] S] u0

Parameters
[u0S] : list
S: value to get
Returns
u0 : corresponding value

◆ switchInv()

switchInv ( ,
 
)

invert switch parameter

Prototype: fun [[u0 I] I] u0

Parameters
[u0I] : list
I: value to get
Returns
u0 : corresponding value