TSPparse component

Parent Class: TComponent


Non-Visual Component to split a String at a given Character into several new Strings.

Legal issues:


This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented, you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.



Properties
Methods
Events

Copyright © 2000 by Stefan Petersen (sp531561@t-online.de)


Properties

property AboutComponent : String

About the Component


property AboutVersion : String

The Version and Date of the Component


property Character : String

The Character, where to split the String. Default is ';'.

property Found : String

The amount of Words the SearchText was split into.


property IsSpaceAfterCharacter : Boolean

Set to True, if there is a space or something else after the Split-Character. Default is False.


property SearchText : String

The String, which will be parsed. Default is ''.

property Words : TStrings

Words (TStrings) is the result after the SearchText was split.



Methods

constructor Create(AOwner: TComponent); override

Constructor of the Component.

destructor Destroy; override

Destructor of the Component.

function Execute : Boolean

The Execute-Function of the Component, (True if successfull).

Example:

ListBox.Clear;
ListBox.Sorted := chkSort.Checked;
SPparse.SearchText := EditSearchText.TEXT;
SPparse.Character:=EditCharacter.TEXT;
L4=SPparse.IsSpaceA fterCharacter := chkIsSpaceAfterCharacter.Checked;
IF NOT SPparse.Execute THEN
MessageDlg ('SPparse couldn''t be executed', mtError, [mbOK], 0)
ELSE
BEGIN
ListBox.Items := SPparse.Words;
END;





Events

event OnWordFound(Sender : TObject)

Event is fired when a Word is found out of the Search-String.

Example:

PROCEDURE TForm1.SPparseWordFound (Sender : TObject);
BEGIN
LabelFound.Caption := IntToStr (SPparse.Found) + ' Word(s) found';
END;