Finding a way to extend the DefaultWordBreakFinder's WordStandaloneCharacters

SyntaxEditor for WPF Forum

Posted 8 years ago by Erwin Liong
Version: 16.1.0633
Platform: .NET 4.5
Environment: Windows 10 (64-bit)

Hi Actipro,


I am using the ITextSnapshot's GetWordTextRange to get the text range of a certain word. In my context, certain character combinations should be accepted as a single word. For example, "<>" or "!=" should be accepted as single word representing NOT; or ".." representing a range; "<=", ">="; and many others such as "[:=]". 


I have seen the DefaultWordBreakFinder has a set of predefined standalone characters. With the current predefiend set, I am not able to get the correct WordTextRange. I am planning to extend the WordStandaloneCharacters in DefaultWordBreakFinder to additionally include my set of delimiters.

Is there a way these can be exteded to hold a string? Or, is there a better way of achieving this?


Thank you.

Comments (2)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Erwin,

The DefaultWordBreakFinder properties like WordStandaloneCharacters are CharClass properties.  You can update or set those however you need, and they will alter the logic DefaultWordBreakFinder has.

If you are looking to do something more complex though (which based on your post, it seems like you do), you could make a custom class that implements IWordBreakFinder.  That way you could have the various methods better handle scenarios like navigating around "<>" as a word, etc.

Actipro Software Support

Posted 8 years ago by Erwin Liong

Hi Actipro, 


Understood. Thank you for the help. 



The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.