LPEX
4.4.0

com.ibm.lpex.samples
Class WordsCommand

java.lang.Object
  extended by com.ibm.lpex.samples.WordsCommand
All Implemented Interfaces:
LpexCommand

public class WordsCommand
extends Object
implements LpexCommand

Sample command words - count the words in the current view. Displays the number of visible words and non-space characters in the text. If a selection is in effect, only the selected text is considered.

A simple scanning for letters and digits is used, rather than a BreakIterator, which is sufficient for most types of programming source documents. A word can be optionally defined to consist of any consecutive non-whitespace characters.

Here is the WordsCommand source code.

To run this sample:

See Also:
All the samples

Constructor Summary
WordsCommand()
           
 
Method Summary
 boolean doCommand(LpexView lpexView, String parameters)
          Runs this command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordsCommand

public WordsCommand()
Method Detail

doCommand

public boolean doCommand(LpexView lpexView,
                         String parameters)
Runs this command. Displays the number of words, characters, and lines in the visible text or selection.

Specified by:
doCommand in interface LpexCommand
Parameters:
lpexView - the document view in which the command was issued
parameters - optional parameter: "?" for help, or "any" to define a word as a string of any non-whitespace characters

LPEX
4.4.0

Copyright � 2016 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.