JCL Help:StrKeepChars@AnsiString@TSysCharSet

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Keeps all occurences of specified characters within a string and removes the others.


Pascal

 function StrKeepChars(const S: string; const Chars: TCharValidator): string; overload;
function StrKeepChars(const S: string; const Chars: array of Char): string; overload;
function StrKeepChars(const S: AnsiString; const Chars: TSysCharSet): AnsiString;


Parameters

Parameters Description
const S: string The source string from which to remove the characters.
const Chars: TCharValidator The set of characters to keep within S.


Return Value

A string containing only characters which are within Chars.


Description

StrKeepChars keeps all occurences of the characters specified in the Chars set and removes any other characters from the string. For example, if you pass in 'Joint Endeavour of Delphi Innovators' and specify ['e', 'a', 'o', 'u', 'i', ' '] the resulting string will be 'oi eaou o ei oao'.


About

Unit

JclAnsiStrings


Donator

Anonymous


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page