---
product: Chilkat
product_version: 11.7.0
language: c
language_label: C
class: StringTable
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/c_CkStringTableRef.html
---
# Chilkat StringTable — C — v11.7.0

> Chilkat 11.7.0 · language=c · class=StringTable
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/StringTable.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/c/guide.md`.

## Purpose

**Store, load, search, sort, split, retrieve, and save ordered lists of strings.**

`Chilkat.StringTable` is a simple ordered collection of strings. It can append strings directly, load one string per line from files or `StringBuilder`, search for substrings or wildcard matches, sort the collection, split strings into entries, retrieve strings by index, export the table as line-delimited text, and save the result to a file.

**Ordered string collection**

Store a list of strings in insertion order and retrieve individual entries by zero-based index.

**Append and import**

Add strings directly, append strings from a file, or load line-delimited text from a `StringBuilder`.

**Search strings**

Find entries containing a substring or matching a wildcard pattern when filtering or locating text values.

**Sort entries**

Sort the string collection when deterministic ordering or user-facing display order is needed.

**Split into entries**

Split delimited text into separate string-table entries for easier indexing, searching, sorting, or saving.

**Export and save**

Convert the table back to line-delimited text, copy it to a `StringBuilder`, or save the collection to a file.

**Common pattern:** Use `StringTable` when application code needs a lightweight ordered list of text values. Append or load the strings, search or sort as needed, retrieve entries by index with `StringAt` or `StringAtSb`, then export the final list as line-delimited text or save it to a file.

For an extended overview, see [StringTable Class Overview](https://www.chilkatsoft.com/stringtable_class_overview.asp).

## Object creation, unlocking and error handling

**Create/Dispose**

```c
HCkStringTable instance = CkStringTable_Create();
// ...
CkStringTable_Dispose(instance);
```

`HCkStringTable CkStringTable_Create(void);`

Creates an instance of the HCkStringTable object and returns a handle ("void \*" pointer). The handle is passed in the 1st argument for the functions listed on this page.

`void CkStringTable_Dispose(HCkStringTable handle);`

Objects created by calling CkStringTable_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkStringTable_Dispose.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in C.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `void CkStringTable_getDebugLogFilePath(HCkStringTable cHandle, HCkString retval); void CkStringTable_putDebugLogFilePath(HCkStringTable cHandle, const char *newVal); const char *CkStringTable_debugLogFilePath(HCkStringTable cHandle);` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `void CkStringTable_getLastErrorHtml(HCkStringTable cHandle, HCkString retval); const char *CkStringTable_lastErrorHtml(HCkStringTable cHandle);` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `void CkStringTable_getLastErrorText(HCkStringTable cHandle, HCkString retval); const char *CkStringTable_lastErrorText(HCkStringTable cHandle);` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `void CkStringTable_getLastErrorXml(HCkStringTable cHandle, HCkString retval); const char *CkStringTable_lastErrorXml(HCkStringTable cHandle);` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `BOOL CkStringTable_getLastMethodSuccess(HCkStringTable cHandle); void CkStringTable_putLastMethodSuccess(HCkStringTable cHandle, BOOL newVal);` | read/write | Indicates the success or failure of the most recent method call: `TRUE` means success, `FALSE` means failure. |
| `Utf8` | `BOOL CkStringTable_getUtf8(HCkStringTable cHandle); void CkStringTable_putUtf8(HCkStringTable cHandle, BOOL newVal);` | read/write | When set to `TRUE`, all `const char *` arguments and return values are interpreted as UTF-8 strings. |
| `VerboseLogging` | `BOOL CkStringTable_getVerboseLogging(HCkStringTable cHandle); void CkStringTable_putVerboseLogging(HCkStringTable cHandle, BOOL newVal);` | read/write | If set to `TRUE`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `void CkStringTable_getVersion(HCkStringTable cHandle, HCkString retval); const char *CkStringTable_version(HCkStringTable cHandle);` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `Count` | property, read-only | `int CkStringTable_getCount(HCkStringTable cHandle);` |
| `Append` | method | `BOOL CkStringTable_Append(HCkStringTable cHandle, const char *value);` |
| `AppendFromFile` | method | `BOOL CkStringTable_AppendFromFile(HCkStringTable cHandle, int maxLineLen, const char *charset, const char *path);` |
| `AppendFromSb` | method | `BOOL CkStringTable_AppendFromSb(HCkStringTable cHandle, HCkStringBuilder sb);` |
| `Clear` | method | `void CkStringTable_Clear(HCkStringTable cHandle);` |
| `FindMatch` | method | `int CkStringTable_FindMatch(HCkStringTable cHandle, HCkStringBuilder sb, BOOL caseSensitive);` |
| `FindSubstring` | method | `int CkStringTable_FindSubstring(HCkStringTable cHandle, int startIndex, const char *substr, BOOL caseSensitive);` |
| `GetStrings` | method | `BOOL CkStringTable_GetStrings(HCkStringTable cHandle, int startIdx, int count, BOOL crlf, HCkString outStr); const char *CkStringTable_getStrings(HCkStringTable cHandle, int startIdx, int count, BOOL crlf);` |
| `IntAt` | method | `int CkStringTable_IntAt(HCkStringTable cHandle, int index);` |
| `SaveToFile` | method | `BOOL CkStringTable_SaveToFile(HCkStringTable cHandle, const char *charset, BOOL bCrlf, const char *path);` |
| `Sort` | method | `BOOL CkStringTable_Sort(HCkStringTable cHandle, BOOL ascending, BOOL caseSensitive);` |
| `SplitAndAppend` | method | `BOOL CkStringTable_SplitAndAppend(HCkStringTable cHandle, const char *inStr, const char *delimiterChar, BOOL exceptDoubleQuoted, BOOL exceptEscaped);` |
| `StringAt` | method | `BOOL CkStringTable_StringAt(HCkStringTable cHandle, int index, HCkString outStr); const char *CkStringTable_stringAt(HCkStringTable cHandle, int index);` |
| `StringAtSb` | method | `BOOL CkStringTable_StringAtSb(HCkStringTable cHandle, int index, HCkStringBuilder sb);` |
| `ToSb` | method | `BOOL CkStringTable_ToSb(HCkStringTable cHandle, HCkStringBuilder sb);` |
| `WordFollowing` | method | `int CkStringTable_WordFollowing(HCkStringTable cHandle, HCkStringBuilder sb, BOOL captureEmailAddr, HCkStringBuilder sbWord);` |

## Properties

### StringTable.Count

`Chilkat 11.7.0 · c · StringTable · Count · property · read-only · since 9.5.0.62`

```c
int CkStringTable_getCount(HCkStringTable cHandle);
```

The number of strings in the table.

## Methods

### StringTable.Append

`Chilkat 11.7.0 · c · StringTable · Append · method · since 9.5.0.62`

```c
BOOL CkStringTable_Append(HCkStringTable cHandle, const char *value);
```

Appends a string to the table.

Returns TRUE for success, FALSE for failure.

### StringTable.AppendFromFile

`Chilkat 11.7.0 · c · StringTable · AppendFromFile · method · since 9.5.0.62`

```c
BOOL CkStringTable_AppendFromFile(HCkStringTable cHandle, int maxLineLen, const char *charset, const char *path);
```

Appends strings, one per line, from a file. Each line in the `path` should be no longer than the length specified in `maxLineLen`. The `charset` indicates the character encoding of the contents of the file, such as `utf-8`, `iso-8859-1`, `Shift_JIS`, etc.

Returns TRUE for success, FALSE for failure.

### StringTable.AppendFromSb

`Chilkat 11.7.0 · c · StringTable · AppendFromSb · method · since 9.5.0.62`

```c
BOOL CkStringTable_AppendFromSb(HCkStringTable cHandle, HCkStringBuilder sb);
```

Appends strings, one per line, from the contents of a StringBuilder object.

Returns TRUE for success, FALSE for failure.

### StringTable.Clear

`Chilkat 11.7.0 · c · StringTable · Clear · method · since 9.5.0.62`

```c
void CkStringTable_Clear(HCkStringTable cHandle);
```

Removes all the strings from the table.

### StringTable.FindMatch

`Chilkat 11.7.0 · c · StringTable · FindMatch · method · since 11.1.0`

```c
int CkStringTable_FindMatch(HCkStringTable cHandle, HCkStringBuilder sb, BOOL caseSensitive);
```

This string table object holds strings with wildcards. The method returns the index of the wildcarded string that matches the text in `sb`, or -1 if no match is found. `caseSensitive` specifies whether the matching should be case-sensitive.

### StringTable.FindSubstring

`Chilkat 11.7.0 · c · StringTable · FindSubstring · method · since 9.5.0.77`

```c
int CkStringTable_FindSubstring(HCkStringTable cHandle, int startIndex, const char *substr, BOOL caseSensitive);
```

Return the index of the first string in the table containing `substr`. Begins searching strings starting at `startIndex`. If `caseSensitive` is `TRUE`, then the search is case sensitive. If `caseSensitive` is `FALSE` then the search is case insensitive. Returns -1 if the `substr` is not found.

### StringTable.GetStrings

`Chilkat 11.7.0 · c · StringTable · GetStrings · method · since 9.5.0.87`

```c
BOOL CkStringTable_GetStrings(HCkStringTable cHandle, int startIdx, int count, BOOL crlf, HCkString outStr);
const char *CkStringTable_getStrings(HCkStringTable cHandle, int startIdx, int count, BOOL crlf);
```

Return the number of strings specified by `count`, one per line, starting at `startIdx`. To return the entire table, pass 0 values for both `startIdx` and `count`. Set `crlf` equal to `TRUE` to emit with CRLF line endings, or `FALSE` to emit LF-only line endings. The last string is emitted includes the line ending.

Returns TRUE for success, FALSE for failure.

### StringTable.IntAt

`Chilkat 11.7.0 · c · StringTable · IntAt · method · since 9.5.0.63`

```c
int CkStringTable_IntAt(HCkStringTable cHandle, int index);
```

Returns the Nth string in the table, converted to an integer value. The `index` is 0-based. (The first string is at index 0.) Returns -1 if no string is found at the specified index. Returns 0 if the string at the specified index exist, but is not an integer.

### StringTable.SaveToFile

`Chilkat 11.7.0 · c · StringTable · SaveToFile · method · since 9.5.0.62`

```c
BOOL CkStringTable_SaveToFile(HCkStringTable cHandle, const char *charset, BOOL bCrlf, const char *path);
```

Saves the string table to a file. The `charset` is the character encoding to use, such as `utf-8`, `iso-8859-1`, `windows-1252`, `Shift_JIS`, `gb2312`, etc. If `bCrlf` is `TRUE`, then CRLF line endings are used, otherwise LF-only line endings are used.

Returns TRUE for success, FALSE for failure.

### StringTable.Sort

`Chilkat 11.7.0 · c · StringTable · Sort · method · since 9.5.0.87`

```c
BOOL CkStringTable_Sort(HCkStringTable cHandle, BOOL ascending, BOOL caseSensitive);
```

Sorts the strings in the collection in ascending or descending order. To sort in ascending order, set `ascending` to `TRUE`, otherwise set `ascending` equal to `FALSE`.

Returns TRUE for success, FALSE for failure.

### StringTable.SplitAndAppend

`Chilkat 11.7.0 · c · StringTable · SplitAndAppend · method · since 9.5.0.62`

```c
BOOL CkStringTable_SplitAndAppend(HCkStringTable cHandle, const char *inStr, const char *delimiterChar, BOOL exceptDoubleQuoted, BOOL exceptEscaped);
```

Splits a string into parts based on a single character `delimiterChar`. If `exceptDoubleQuoted` is `TRUE`, then the delimiter char found between double quotes is not treated as a delimiter. If `exceptEscaped` is `TRUE`, then an escaped (with a backslash) delimiter char is not treated as a delimiter.

Returns TRUE for success, FALSE for failure.

### StringTable.StringAt

`Chilkat 11.7.0 · c · StringTable · StringAt · method · since 9.5.0.62`

```c
BOOL CkStringTable_StringAt(HCkStringTable cHandle, int index, HCkString outStr);
const char *CkStringTable_stringAt(HCkStringTable cHandle, int index);
```

Returns the Nth string in the table. The `index` is 0-based. (The first string is at index 0.)

Returns TRUE for success, FALSE for failure.

### StringTable.StringAtSb

`Chilkat 11.7.0 · c · StringTable · StringAtSb · method · since 11.2.0`

```c
BOOL CkStringTable_StringAtSb(HCkStringTable cHandle, int index, HCkStringBuilder sb);
```

Appends the Nth string in the table to `sb`. The `index` is 0-based. (The first string is at index 0.)

Returns TRUE for success, FALSE for failure.

### StringTable.ToSb

`Chilkat 11.7.0 · c · StringTable · ToSb · method · since 11.3.0`

```c
BOOL CkStringTable_ToSb(HCkStringTable cHandle, HCkStringBuilder sb);
```

Appends the entire string table to `sb` using CRLF line endings.

Returns TRUE for success, FALSE for failure.

### StringTable.WordFollowing

`Chilkat 11.7.0 · c · StringTable · WordFollowing · method · since 11.1.0`

```c
int CkStringTable_WordFollowing(HCkStringTable cHandle, HCkStringBuilder sb, BOOL captureEmailAddr, HCkStringBuilder sbWord);
```

The method performs a case-insensitive search to return the index of a table entry matching `sb`, or -1 if there is no match. Set `captureEmailAddr` to `TRUE` if the target word is expected to be an email address, otherwise set `captureEmailAddr` to `FALSE`. `sbWord` will receive the word (email address) following the matched text. This method helps replace the outdated Chilkat Bounce class, which was used for identifying and categorizing bounced email types.

## Related classes

[`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/c/classes/StringBuilder.md)

