Concept of Words

# What is a Word

One of the foundation concepts in Future Lab GPL software is that of the word. The building blocks of the concept are defined in the GPL library modules parse.c (C) and the C++ class wstring.cpp.

A word is a series of characters delimited by a specific character. Words can be delimited by any specific character.

Here are some examples of word strings:

- word1, word2, word3
- word1@word2@word3
- _word2_word3
- word1!word2!

Each of the previous examples contains three words. In the third example, the first word is blank since the string starts with the delimiter. In the last example, the last word is blank since the string ends in a delimiter. In the first example, the second word and the third word will be retrieved with the leading space.

# What is a Command Word

Higher up on the word chain is the concept of the command word which enhances the word by allowing quoted multiple words. The delimiter in command words is always the space character. Quoted command line data can easily be parsed using the command word functions. Here are some example of a command word string:

- word1 'quoted word 2' word3 "quoted word 4"
- word1 "quoted word2

The quotes must be balanced, that is, the ending quote must be the same type as the starting quote. The ending quote may be omitted if the last command word is quoted. The first example above contains four command words, two quoted, two not quoted. The two quoted command words in the first example are using different quotes. The second example above shows that the trailing close quote may be omitted in the case of the last quoted command word.

The word is at the core of just about all Future Lab GPL software. The database engine, for example, uses a record string containing a series of words.

Goto Top | GPL Software Overview | GPL Library
Future Lab Home | Contact Webmaster | Feedback

Copyright © 1999-2006 Future Lab, Last Updated Jun 30, 2006