| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (5 out of 11)

Ordinary Text Manipulation Functions

G2 provides ordinary text-manipulation functions similar to those that exist in most programming languages, as described in this section.

Text functions in general are described under G2 Text Manipulation Functions and G2 Conventions for Manipulating Text. G2 functions in general are described in Chapter 25, Functions.

Obtaining Text Length

length-of-text 
(text-expression: text)
-> length: integer

Testing for a Substring

is-contained-in-text 
(text-expression1: text, text-expression2:text)
-> substring-exists: truth-value

Locating a Substring

position-of-text 
(text-expression1: text, text-expression2: text)
-> start-position: integer

Obtaining a Substring

get-from-text 
(text-expression: text, start-position: integer, end-position: integer)
-> substring: text)

Inserting a Substring

insert-in-text 
(text-expression1: text, text-expression2: text, insert-position: integer)
-> combined-text: text

Replacing One Substring With Another

replace-in-text 
(text-to-substitute: text, source-text: text,
start-index: integer, end-index: integer)
-> modified-text: text

Deleting a Substring

omit-from-text 
(text-expression: text, start-position: integer, end-position: integer)
-> remaining-text: text

Capitalizing Text

capitalize-words 
(text-expression: text)
-> capitalized-string: text

Converting Text to Uppercase

upper-case-text 
(text-expression: text)
-> uppercased-text: text

Converting Text to Lowercase

lower-case-text 
(text-expression: text)
-> lowercased-text: text

Testing for a Quantity

text-begins-with-quantity 
(text-expression: text)
-> quantity-present: truth-value
| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (5 out of 11)

Copyright © 1997 Gensym Corporation, Inc.