|
Class: StringPattern
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
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:]
copyrightCOPYRIGHT (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.
instance creation
-
includes: aString
-
-
matches: aString
-
-
readFrom: aStringOrStream onError: exceptionBlock
-
StringPattern readFrom: 'abcd'
StringPattern readFrom: ' abcd'
StringPattern readFrom: ' a??d'
StringPattern readFrom: ' a*d*'
StringPattern readFrom: 'abcd*'
-
startsWith: aString
-
conversion
-
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
-
on: anObject
-
matching
-
match: string
-
-
match: string case: case
-
-
match: string case: case relax: relax
-
-
match: string from: from to: to
-
-
match: string from: from to: to case: case
-
-
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) **
-
match: string from: from to: to relax: relax
-
-
match: string relax: relax
-
printing & storing
-
printOn: aStream
-
append a printed representation of the receiver to the argument, aStream
utilities
-
matchObject: anObject
-
Return true if pattern matches given object with relax level 1.
Some heuristics is performed to obtain the object's textual representation.
-
matchObject: object relax: relax
-
Return true if pattern matches given object.
Some heuristics is performed to obtain the object's textual representation.
Includes
Matches
Parser
StartsWith
|