Documentation
Back to website >

KillFiller (Pascalscript)

Description

The KillFiller function can remove a given character from a string.

Syntax

function KillFiller(Code, Filler: char; S: String):String;

Arguments

This function removes all character fillers that appear in text S. The behavior of this function is determined by code.

The following values apply to the code:

CodeBehaviour
LDeletes all characters that correspond to fillers from the left until the first character that does not correspond to more fillers.
RDeletes all characters that correspond to fillers from the right until the first character that does not correspond to more fillers.
BCorresponds to a combination of L and R. The character Filler is deleted from both sides of text S until the first character that no longer corresponds to Filler.
ADeletes all characters in the text S.

Excample

var
  S1: String;
  S2: String;
begin
  S1:='***This is ** a text***';
  S2:=KillFiller('B','*',S1);
  ShowMessage(s2);
end;

Rules to understand the script can be found here.

The text '***This is ** a text***' is assigned to the string variable S1. The KillFiller function deletes all asterisks from the left and right side of the text, since the code is used as'B'. The result is assigned to S2.

ShowMessage shows: This is ** a text