String  

Search() Extract() Length()
ToString() ToReal() ReplaceSubText()
ToUpper() ToLower() BuildMessageNLS

Search()  

Searches for the first occurrence of a sub string in a String type parameter. Returns the index (o or 1) of the start of the substring. Returns -1 is the substring specified is not found.

Syntax

String  -> Search(StringToBeSearchedFor: String, index: Integer, forward : Boolean):Integer

Example 1

Let I1search = 0
Let Responsible = "Cilas Evans"
I1Search = Responsible  ->  Search("Evans")
/* I1 Search equals 6 */

Example 2

Let I1search = 0
Let Responsible = “Cilas Evans Evans”
I1Search  = Responsible  ->  Search(”Evans”,7)
/* I1 Search equals 12 */

Example 3

Let I1search = 0
Let Responsible = “Cilas Evans Evans”
I1Search  = Responsible  ->  Search(”Evans”,0,false)
/* I1 Search equals 12 */

Sample

KwrString.CATPart

 

Extract()  

Returns the sub string starting at a given position with a specified length.

Syntax

String  ->  Extract(StartIndex: Integer, Length: Integer) : String

where StartIndex is the index (0 or 1) of the substring first character and Length the sub string length.

Example

Let Responsible = “Cilas Evans Evans”
Message (“#”,Responsible  ->  .Extract(2,2))
/* “la” is displayed

Sample

KwrString.CATPart
 

Length()  

Applies to a string type parameter. Returns the string length.

Syntax

string.Length(Integer)

Example

Let Responsible = “Cilas Evans Evans”
Let i=0
I = Responsible  ->  Length()

Sample

KwrString.CATPart

 

ToString()  

Converts an integer into a string. 

Syntax

ToString(Real) : String

Example

Let s = “”
s = ToString(3.4)

Sample

KwrString.CATPart

 

ToReal()  

Converts a string into a real. 

Syntax

String   ->  ToReal(Real): Real

Example

Let s = “2.3”
Let r=0.0
r = s -> ToReal()

 

ReplaceSubText()  

Replaces a sub string with another substring within a character string.

Syntax

ReplaceSubText(InputString: String, SubStringToBeReplaced: String, ReplacingSubString: String): String

Arguments 2 and 3 can be specified either with their parameters names or with the string itself between quotes.

Sample

KwrString.CATPart

ToUpper()  

Changes all lower-case letters of a string to upper-case.

Syntax

ToUpper(StringTobeConverted: String): String

where StringTobeConverted is name of the string type parameter.

Sample

KwrString.CATPart

ToLower()  

Changes all upper-case letters of a string to lower-case.

Syntax

ToLower(StringTobeConverted: String): String

where StringTobeConverted is name of the string type parameter.

Sample

KwrString.CATPart

BuildMessageNLS

Enables you to send messages or ask questions through the Message and Question functions in the language of your choice. The BuildMessageNLS function can build a NLS message (a message in a given language) by finding it in a CATXXX.CATNls file.

Note that this function is useful when used together with the Message and Question functions. For more information about these 2 functions, see the Knowledge Advisor User's Guide.

Syntax

BuildMessageNLS(MessageCatalog:String, MessageKey: String, argument: Literal, ...):String

where:

Example

The KwrCATCatalog.CATNls file contains the following text.
 

Zero = "Zero";

One = "One /P1";

Two = "Two /P1 /P2";

Zero, One and Two are the messages. The first message has no arguments, the second has 1 argument, the third, 2 arguments.

To display those messages in a Knowledge Advisor rule for example, enter the following rule body:
 

Message (BuildMessageNLS("KwrCATCatalog","Zero"))

OR

Message (BuildMessageNLS("KwrCATCatalog","One",x))

Where x is a parameter.

OR

Message (BuildMessageNLS("KwrCATCatalog","Two",y,z))

Where y, and z are parameters.

 

  • If the function does not find the key or the .NLS catalog, it will return an empty string.
  • If there are too many parameters compared to the number of arguments of the message, the parameters will be ignored.
  • If there are too few parameters compared to the number of arguments of the message, the parameters will be replaced with a "???" string.
  • Note that the .NLS file is to be stored in the runtime view (in the msgcatalog directory)

Sample

KwrCATCatalog.CATPart (See Rule.2)