CapeSoft StringTheory

 

 

 

Version: version number
CapeSoft Software copyright

 



Introduction

 

Introduction

StringTheory provides simple string handling and manipulation, including dynamic memory allocation (the string is always the correct length, and any amount of data can be added to it), fast and simple string parsing

StringTheory will easily help you:

  • Store and manipulate string
  • Handle encoding and decode (such as Base64 encode and decode)
  • Split, join, search and otherwise process strings
  • Load and save to and from BLOBs
  • Load and save to and from disk
  • Break a string into lines based on delimiters, process the data, and rebuild the string
  • Convert to and from cstring
  • Much, much more
  • Convert between ANSI and Unicode (UTF-8)
  • MD5 hashing
  • Compress and Decompress a sting using the ZLIBWAPI DLL.

StringTheory provides Unicode support in the form of UTF-8, as well as converting between ANSI and UTF-8 strings

We strongly recommend starting with the example applications, which are described below in the Example section.


Features

 

StringTheory provides dynamic memory allocation, string handling and manipulation, conversion between string and cstring data types, base64 encoding and decoding, file loading and saving, and much more.

See the Class Reference for a list of all methods and properties provided.

 

Using CapeSoft StringTheory

 

Add StringTheory to your application in a few Easy Steps!

Add the global and local extension

  1. Add the Global Extension:
    Global -> Extensions -> Insert -> Activate CapeSoft StringTheory.
    For Multi-DLL apps - do this in the main exe application.
  2. Add the Local extension to the procedure that you wish to use StringTheory in.
    This adds a StringTheory object to the procedure.

Using StringTheory

The code below demonstrates using the StringTheory class for a variety of common tasks.

In general a StringTheory object is declared as simply as

st StringTheory

Where st is the label name (and can be almost anything.) The length of the string is undefined, and is dynamic. In other words the string will automatically grow, and shrink as required. You do not need to worry about the length.

Values are assigned into the string using the SetValue method, or by loading a file off the disk using the LoadFile method.

st.SetValue('hello world')

st.LoadFile('c:\windows\win.ini')

After that the string can be manipulated in a number of different ways, using the methods described in the Class Reference. For example to Base64 encode the string;

st.Base64Encode()

Distribution

If you use the Gzip or Gunzip methods in your application then you will need to distribute the ZLIBWAPI.DLL with your application. This DLL is located in your \3rdparty\bin or \accessory\bin folder, and is also available from the official source at http://www.winimage.com/zLibDll/index.html. The Zlib library home can be found here http://www.zlib.net.

ZLIB is the product of Jean-loup Gailly and Mark Adler and is distributed under the terms of their license at http://www.zlib.net/zlib_license.html .

 

 

 

Examples

 

Demo

This is the main StringTheory example application. It demonstrates a variety of common and useful tasks using the StringTheory class.


FAQs

 

Compile Errors

No .c in red file 

Solution: You have no *.c entry in your red file. Re-run the installer, taking care to check the "Update Clarion Redirection file" checkbox.


The StringTheory Templates

 

The Global Extension template:

  There are no options for the Global extension.

The StringTheory local extension template

Add this extension to populate an instance of the StringTheory class for you. This can also be done very simply in your code:

st                   StringTheory
  code
    st.Assign('Some Value')

 

The StringTheory Templates

 

Acknowledgements:

StringTheory includes some code originally appearing in a StringClass, written by Rick Martin and published in ClarionMag and is used with permission.

Many thanks to Geoff Robinson for feedback and contributions to StringTheory, including bug fixes, improvements and new methods!

ZLIB is the product of Jean-loup Gailly and Mark Adler and is distributed under the terms of their license at http://www.zlib.net/zlib_license.html .

 




All content © Copyright CapeSoft Software