fbpx

Руководство пользователя

Функции для работы с текстом

Звезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активна
 

Функции для работы с текстом, которые вы можете использовать в своих приложениях для TechEditor.

Comparison of text strings

function AnsiCompareStr(S1, S2: string): Integer;

Compares S1 to S2, with case sensitivity. The return value is less than 0 if S1 < S2, 0 if S1 = S2, or greater than 0 if S1 > S2.

function AnsiCompareText(S1, S2: string): Integer;

Compares S1 to S2, without case sensitivity. The return value is less than 0 if S1 < S2, 0 if S1 = S2, or greater than 0 if S1 > S2.

function CompareStr(S1, S2: string): Integer;

Compare two strings S1 to S2 with case-sensitivity. The return value is less than 0 if S1 < S2, 0 if S1 = S2, or greater than 0 if S1 > S2. Use CompareText to compare strings without case-sensitivity.

function CompareText(S1, S2: string): Integer;

Compare two strings S1 to S2 for equality without case-sensitivity. The return value is less than 0 if S1 < S2, 0 if S1 = S2, or greater than 0 if S1 > S2. Use CompareStr to compare strings with case-sensitivity.

Converting text strings to other formats and vice versa

function FloatToStr(X: Double): string;

Converts a floating-point value to a string. If the given value is a NAN (not-a-number), the resulting string is 'NAN'. If the given value is positive infinity, the resulting string is 'INF'. If the given value is negative infinity, the resulting string is '-INF'.

 Пример на TechEditor Pascal Script (.PSC):

var
A: Double;
S: string;

begin
A := Sin(Math.Pi / 4);
S := FloatToStr(A); // S='0.707..';
end;

function IntToStr(X: Integer): string;

Converts an integer X to a string. Returns the result of conversation.

 Пример на TechEditor Pascal Script (.PSC):

var
A: Integer;
S: string;

begin
A := 2 + 5;
S := IntToStr(A); // S='7';
end;

function StrToFloat(S: string): Double;

Converts a given string S to a floating-point value.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;
X: Double;

begin
S := '1.456';
X := StrToFloat(S); // X=1.456
end;

function StrToInt(S: string): Integer;

Converts a given string S to integer value.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;
X: Integer;

begin
S := '-15';
X := StrToInt(S); // X=-15
end; 

function StrToIntDef(S: string; DefValue: Integer): Integer;

Function converts the string S, which represents an integer-type number, into a number. If S does not represent a valid number, StrToIntDef returns DefValue.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;
X: Integer;

begin
S := '25 cm';
X := StrToIntDef(S, 0); // X=0 because '25 cm' is invalid integer value!
end; 

function Math.StrToFloatDef(S: string; DefValue: Double): Double;

Function converts the string S into a floating-point value. If S does not represent a valid floating-point value, function returns DefValue.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;
X: Double;

begin
S := '25.5 cm';
X := Math.StrToFloatDef(S, 1.0); // X=1 because '25.5 cm' is incorrect value!
end;

Case conversions

function AnsiLowerCase(S: string): string;

Returns a string S, but with all letters converted to lowercase.

function AnsiUpperCase(S: string): string;

Returns a string S, but with all letters converted to uppercase.

function LowerCase(S: string): string;

Returns a string S, but with all letters converted to lowercase.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;

begin
S := LowerCase('SUCCESS'); // S='success';
end;

function UpperCase(S: string): string;

Returns a string S, but with all letters converted to uppercase.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;

begin
S := UpperCase('success'); // S='SUCCESS';
end;

Other routins

procedure Delete(var S: string; Index, Count: Integer);

Procedure removes a substring of Count characters from string S, starting with S[Index] character. If Index is larger than the length of the string (or less than 1), no characters are deleted. If Count specifies more characters than remain starting at Index, Delete removes the rest of the string. If Count is less than or equal to 0, no characters are deleted.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;

begin
S := 'TechEditor';
Delete(S, 1, 4); // S='Editor'
end;

function Chr(X: Byte): Char;

Chr returns the character with the ordinal value X (ASCII value).

 Пример на TechEditor Pascal Script (.PSC):

var
C: Char;

begin C := Chr(82); // C='R'
end;

function Copy(S: string; Index, Count: Integer): string;

Copy returns a substring of a string S containing Count characters starting at S[Index]. If Index is larger than the length of S, Copy returns an empty string. If Count specifies more characters than are available, only the characters or elements from S[Index] to the end of S are returned.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;

begin
S := 'TechEditor'; S := Copy(S, 1, 4); // S='Tech'
end; 

function Length(S: string): Integer;

Returns the number of characters in a string.

 Пример на TechEditor Pascal Script (.PSC):

var
X: Integer;

begin
X := Length('hello'); // x=5
end;

function Ord(C: Char): Byte;

Returns the ordinal value of a character C in accordance to ASCII table.

 Пример на TechEditor Pascal Script (.PSC):

var
i: Integer;

begin i := Ord('R'); // i=82
end;

function Pos(SearchStr, S: string): Integer;

Function returns the index of the first occurrence of SearchStr in string S.

 Пример на TechEditor Pascal Script (.PSC):

var
i: Integer;

begin i := Pos('Edit', 'TechEditor'); // i=5
end;

function Trim(S: string): string;

Function removes leading and trailing spaces and control characters from the given string S.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;

begin
S := Trim(' Dystlab TechEditor '); // S='Dystlab TechEditor'
end;

function TrimLeft(S: string): string;

Function removes blank and control characters from the left side of a string.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;

begin
S := Trim(' Dystlab TechEditor '); // S='Dystlab TechEditor '
end;

function TrimRight(S: string): string;

Function removes blank and control characters from the right side of a string.

 Пример на TechEditor Pascal Script (.PSC):

var
S: string;

begin
S := Trim(' Dystlab TechEditor '); // S=' Dystlab TechEditor'
end;

 

Мероприятия

К сожалению, в настоящий момент нет мероприятий.
Просмотреть все мероприятия

Простой калькулятор в TechEditor за 10 минут!

Ontario Building Code 2012 | Load combination (Free Application & Report Template)

Видеообзор версии 1.0

Новые статьи

Dystlab™ — Project for Engineers

Dystlab™ — торговая марка, зарегистрированная в Государственном реестре свидетельств Украины на знаки для товаров и услуг 26.02.2018, свидетельство № 238304. Владелец: физическое лицо-предприниматель Артемов В. Е., ЕГРПОУ/ИНН: 3003314690.

E-mail:
technot needed texteditoranother not needed text@dystlabdummy text.store

Telegram:
https://t.me/techeditor

 

Всё самое интересное о TechEditor — в Телеграм. Присоединяйся!

TechEditor - Telegram channel