eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'StringPattern':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: StringPattern


Inheritance:

   Object
   |
   +--StringPattern
      |
      +--StringPattern::Includes
      |
      +--StringPattern::Matches
      |
      +--StringPattern::StartsWith

Package:
stx:libbasic2
Category:
Collections-Text-Support
Version:
rev: 1.15 date: 2021/01/20 12:20:27
user: cg
file: StringPattern.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


A StringPattern instances are used to match string. The
pattern is build from a user-supplied string. It is the
intention to let the user type the search pattern - it can
be used for various live searches in lists, dialogs etc.

This is an unfinished class. More detailed description about
syntax and algorithm will be added once the results will be
considered good and the API become stable. 
If not, blame it on JV :-)


[instance variables:]

[class variables:]

copyright

COPYRIGHT (c) 2011 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

instance creation
o  includes: aString

o  matches: aString

o  readFrom: aStringOrStream onError: exceptionBlock
StringPattern readFrom: 'abcd'
StringPattern readFrom: ' abcd'
StringPattern readFrom: ' a??d'
StringPattern readFrom: ' a*d*'
StringPattern readFrom: 'abcd*'

o  startsWith: aString


Instance protocol:

conversion
o  asString
Returns a string representation of the pattern.

`StringPattern fromString: pattern asString` should return
the same pattern (same meaning equal)

** This method must be redefined in concrete classes (subclassResponsibility) **

initialization
o  on: anObject

matching
o  match: string

o  match: string case: case

o  match: string case: case relax: relax

o  match: string from: from to: to

o  match: string from: from to: to case: case

o  match: string from: from to: to case: case relax: relax
Answers true if receiver matches the given `string`
portion starting at `from`, ending at `to`.
If `case` is true, then perform natch case sensitive,
otherwise match case insensitive.

`relax` argument say how much the matching should
be relaxed - relax is a number in <1..3>, where
1 means no relaxing at all (aka exact match).
All patterns should support relax == 1. If the relax
level is not supported by a pattern, false must be
returned.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  match: string from: from to: to relax: relax

o  match: string relax: relax

printing & storing
o  printOn: aStream
append a printed representation of the receiver to the argument, aStream

utilities
o  matchObject: anObject
Return true if pattern matches given object with relax level 1.

Some heuristics is performed to obtain the object's textual representation.

o  matchObject: object relax: relax
Return true if pattern matches given object.

Some heuristics is performed to obtain the object's textual representation.


Private classes:

    Includes
    Matches
    Parser
    StartsWith


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:56:29 GMT