Function SetCollationTable() Foundation
Query current and/or set user defined collation table for current thread
SetCollationTable( [<nCollation>], ;
[<aCollationTable>] ) --> aOldCollationTable
If SetCollationTable() is called without the argument <aCollationTable>, the function returns a one dimensional array holding the weighing factors of characters for the current thread's active collation. If <nCollation> is passed, a weighing table for the specified collation is returned.
The function SetCollationTable() retrieves a collation table that defines sorting and comparison rules for characters. When using COLLAT_USER for <nCollation>, the functions allows the configuration of a user defined collation table.
The collation table setting is thread local. When a new thread is created, it inherits the collation table setting of the thread in which it is created.
Note that only the COLLAT_USER collation table can be configured. All other collation tables are read-only.
// The example demonstrates how to activate
// a user-defined collation table
#include "Collat.ch"
PROCEDURE Main
LOCAL aCollation, n
aCollation := SetCollationTable( COLLAT_AMERICAN )
? "A" = "Z" // Result: .F.
n := aCollation[ Asc("Z") + 1 ]
aCollation[ Asc("A") + 1 ] := n
SetCollationTable( COLLAT_USER, aCollation )
SetCollation( COLLAT_USER )
? "A" = "Z" // Result: .T.
SetCollation( COLLAT_AMERICAN )
? "A" = "Z" // Result: .F.
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.