Please enable JavaScript to view this site.

KOL/MCK - User Guide

So let's start with the basics:

The names of the functions for converting strings to numbers and vice versa in KOL, as already mentioned, differ from the names of similar functions in SysUtils. Particle "To" in most cases is replaced by a consonant (for English) number 2: not IntToStr, but Int2Str, for example. Here is an incomplete list of such functions: Int2Str (i), Str2Int (i), UInt2Str (i), Int2Hex (i, n), Hex2Int (s), Copy (s, i, n), CopyEnd (s, i), CopyTail (s, n), etc ..

 

Additional conversion functions:

Int2Rome (i) - "writes" a number from 1 to 8999 in Roman numerals;

Int2Ths (i) - the same as Int2Str, but the triples of digits are separated from each other by a special separator (by default - a space, but this can be easily changed by assigning your own separator to the global variable ThsSeparator);

Int2Digs (i, n) - the same as Int2Str, but the required number of leading spaces is added before the number so that the resulting string is at least n;

Num2Bytes (d) - forms the representation of the number of bytes (specified by the double precision floating point parameter) in the form n or nK or nM or nG or nT - depending on the parameter value;

S2Int (s) - the same as Str2Int, but works with a parameter of type PChar, not ANSI string;

cHex2Int (s) - similar to Hex2Int, but understands hexadecimal numbers, written according to the rules of the C language (leading 0x characters are discarded);

Octal2Int (s), Binary2Int (s) - the purpose of these functions is obvious.

There is also a Format (s, ...) function - but in KOL it uses the wvsprintf API, so it doesn't understand floating point formatting.

 

In addition, KOL has a number of functions to facilitate parsing (parsing) of strings:

Parse (s, d) - returns part of string s up to the first of the encountered characters from string d, leaving only the part after the encountered delimiter in the string s itself.

StrIsStartingFrom (s, p) - Checks that the beginning of string s matches string p.

StrSatisfy (s, p) - checks the string s against a pattern (the pattern can contain the mask characters '*' and '?', Interpreted, respectively, as "any characters" and "one arbitrary character").

SkipSpaces(s) - skips spaces, moving s to the next printable character in the line.

DelimiterLast(s, d) - returns the position of the last separator character from string d in string s;

IncludeTrailingChar (s, c) - returns s, adding character c if it is not already the last in the line;

ExcludeTrailingChar (s, c) - on the contrary, it removes the trailing c.

 

A number of functions for working with strings in KOL have been moved, sometimes with some changes, from the standard SysUtils module

I do not make any secret from this, the main reason is that in KOL projects it is undesirable to use the SysUtils module itself, due to the increase in the size of the application by 20-30 KB, at the same time these functions are often needed:

StrComp (s1, s2), StrLComp (s1, s2, n), StrCopy (s1, s2), StrCat (s1, s2), StrLen (s ), StrScanLen (s, c, n), StrScan (s, c), StrRScan (s, c), Trim (s), TrimLeft (s), TrimRight (s), LowerCase (s), UpperCase (s), AnsiLowerCase (s), AnsiUpperCase (s).

And in addition to them there are: StrComp_NoCase (s1, s2), StrLComp_NoCase (s1, s2, n), Str2LowerCase (s) - takes a PChar parameter, and performs string modification in place. And also: RemoveSpaces (s), WAnsiUpperCase (s), WAnsiLowerCase (s).

 

KOL / MCK User Guide - Created by Carl Peeraer - Diamant Soft, based on the work of Vladimir Kladov - Artwerp.be

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC