---
product: Chilkat
product_version: 11.7.0
language: dataflex
language_label: DataFlex
class: CkString
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/dataflexCkStringRef.html
---
# Chilkat CkString — DataFlex — v11.7.0

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

## Purpose

The Chilkat string class.

## Object creation, unlocking and error handling

**Object Creation**

```dataflex
// (Dataflex programs use the 32-bit Chilkat ActiveX)
Handle hoCkString
Get Create(RefClass(cComCkString)) to hoCkString
```

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 DataFlex.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## Member index

| Member | Kind | Signature |
|---|---|---|
| `NumArabic` | property, read-only | `Function ComNumArabic Returns Integer` |
| `NumAscii` | property, read-only | `Function ComNumAscii Returns Integer` |
| `NumCentralEuro` | property, read-only | `Function ComNumCentralEuro Returns Integer` |
| `NumChars` | property, read-only | `Function ComNumChars Returns Integer` |
| `NumChinese` | property, read-only | `Function ComNumChinese Returns Integer` |
| `NumCyrillic` | property, read-only | `Function ComNumCyrillic Returns Integer` |
| `NumGreek` | property, read-only | `Function ComNumGreek Returns Integer` |
| `NumHebrew` | property, read-only | `Function ComNumHebrew Returns Integer` |
| `NumJapanese` | property, read-only | `Function ComNumJapanese Returns Integer` |
| `NumKorean` | property, read-only | `Function ComNumKorean Returns Integer` |
| `NumLatin` | property, read-only | `Function ComNumLatin Returns Integer` |
| `NumThai` | property, read-only | `Function ComNumThai Returns Integer` |
| `SizeAnsi` | property, read-only | `Function ComSizeAnsi Returns Integer` |
| `SizeUtf8` | property, read-only | `Function ComSizeUtf8 Returns Integer` |
| `Str` | property, read/write | `Function ComStr Returns String Procedure Set ComStr String value` |
| `AnsiCharAt` | method | `Function ComAnsiCharAt Integer index Returns Integer` |
| `Append` | method | `Procedure ComAppend String str` |
| `AppendDateRfc3339` | method | `Procedure ComAppendDateRfc3339 DateTime dt` |
| `AppendDateRfc822` | method | `Procedure ComAppendDateRfc822 DateTime dt` |
| `AppendEncoded` | method | `Procedure ComAppendEncoded String str String encoding String charset` |
| `AppendMultibyte` | method | `Procedure ComAppendMultibyte Variant mbtext String charsetEncoding` |
| `AppendToFile` | method | `Function ComAppendToFile String path String charsetEncoding Returns Boolean` |
| `BeginsWith` | method | `Function ComBeginsWith String str Returns Boolean` |
| `ChopAfter` | method | `Procedure ComChopAfter String findStr` |
| `ChopBefore` | method | `Procedure ComChopBefore String findStr` |
| `Clear` | method | `Procedure ComClear` |
| `Contains` | method | `Function ComContains String substr Returns Boolean` |
| `EmitMultibyte` | method | `Function ComEmitMultibyte String charsetEncoding Returns Variant` |
| `EndsWith` | method | `Function ComEndsWith String substr Returns Boolean` |
| `GetEncoded` | method | `Function ComGetEncoded String binaryEncoding String charsetEncoding Returns String` |
| `HtmlEntityDecode` | method | `Procedure ComHtmlEntityDecode` |
| `HtmlEntityEncode` | method | `Procedure ComHtmlEntityEncode` |
| `LastAnsiChar` | method | `Function ComLastAnsiChar Returns Integer` |
| `Left` | method | `Function ComLeft Integer numChars Returns String` |
| `Length` | method | `Function ComLength Returns Integer` |
| `LoadFile` | method | `Function ComLoadFile String path String charsetEncoding Returns Boolean` |
| `LoadXmlDoc` | method | `Procedure ComLoadXmlDoc Variant xmlDocumentBytes` |
| `Matches` | method | `Function ComMatches String strPattern Boolean caseSensitive Returns Boolean` |
| `Mid` | method | `Function ComMid Integer index Integer numChars Returns String` |
| `ParseDateRfc3339` | method | `Function ComParseDateRfc3339 Returns DateTime` |
| `ParseDateRfc822` | method | `Function ComParseDateRfc822 Returns DateTime` |
| `Pluralize` | method | `Procedure ComPluralize` |
| `Prepend` | method | `Procedure ComPrepend String str` |
| `PunyDecode` | method | `Procedure ComPunyDecode` |
| `PunyEncode` | method | `Procedure ComPunyEncode` |
| `RemoveAnsiChar` | method | `Procedure ComRemoveAnsiChar Integer ch` |
| `ReplaceAll` | method | `Procedure ComReplaceAll String findStr String replaceStr` |
| `ReplaceAnsiChar` | method | `Procedure ComReplaceAnsiChar Integer findCh Integer replaceCh` |
| `ReplaceFirst` | method | `Procedure ComReplaceFirst String findStr String replaceStr` |
| `Right` | method | `Function ComRight Integer numChars Returns String` |
| `SaveToFile` | method | `Function ComSaveToFile String path String charsetEncoding Returns Boolean` |
| `Shorten` | method | `Procedure ComShorten Integer numChars` |
| `StrComp` | method | `Function ComStrComp String str Boolean caseSensitive Returns Integer` |
| `StripHtml` | method | `Procedure ComStripHtml` |
| `ToCRLF` | method | `Procedure ComToCRLF` |
| `ToLF` | method | `Procedure ComToLF` |
| `Trim` | method | `Procedure ComTrim` |
| `Trim2` | method | `Procedure ComTrim2` |
| `TrimInside` | method | `Procedure ComTrimInside` |
| `Unpluralize` | method | `Procedure ComUnpluralize` |

## Properties

### CkString.NumArabic

`Chilkat 11.7.0 · dataflex · CkString · NumArabic · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumArabic Returns Integer
```

The number of Arabic characters contained in this string.

### CkString.NumAscii

`Chilkat 11.7.0 · dataflex · CkString · NumAscii · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumAscii Returns Integer
```

The number of us-ascii characters contained in this string.

### CkString.NumCentralEuro

`Chilkat 11.7.0 · dataflex · CkString · NumCentralEuro · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumCentralEuro Returns Integer
```

The number of Central European and Eastern European characters found in this string. These are characters specific to Polish, Czech, Slovak, Hungarian, Slovene, Croatian, Serbian (Latin script), Romanian and Albanian.

### CkString.NumChars

`Chilkat 11.7.0 · dataflex · CkString · NumChars · property · read-only`

```dataflex
Function ComNumChars Returns Integer
```

The number of characters in the string.

### CkString.NumChinese

`Chilkat 11.7.0 · dataflex · CkString · NumChinese · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumChinese Returns Integer
```

The number of Chinese characters contained in this string.

### CkString.NumCyrillic

`Chilkat 11.7.0 · dataflex · CkString · NumCyrillic · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumCyrillic Returns Integer
```

The number of Cyrillic characters contained in this string. The Cyrillic alphabet also called azbuka, from the old name of the first two letters) is actually a family of alphabets, subsets of which are used by certain East and South Slavic languages `” Belarusian, Bulgarian, Macedonian, Russian, Rusyn, Serbian and Ukrainian`”as well as many other languages of the former Soviet Union, Asia and Eastern Europe.

### CkString.NumGreek

`Chilkat 11.7.0 · dataflex · CkString · NumGreek · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumGreek Returns Integer
```

The number of Greek characters contained in this string.

### CkString.NumHebrew

`Chilkat 11.7.0 · dataflex · CkString · NumHebrew · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumHebrew Returns Integer
```

The number of Hebrew characters contained in this string.

### CkString.NumJapanese

`Chilkat 11.7.0 · dataflex · CkString · NumJapanese · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumJapanese Returns Integer
```

The number of Japanese characters contained in this string.

### CkString.NumKorean

`Chilkat 11.7.0 · dataflex · CkString · NumKorean · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumKorean Returns Integer
```

The number of Korean characters contained in this string.

### CkString.NumLatin

`Chilkat 11.7.0 · dataflex · CkString · NumLatin · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumLatin Returns Integer
```

The number of Latin characters contained in this string. Latin characters include all major Western European languages, such as German, Spanish, French, Italian, Nordic languages, etc.

**Note:** This is the number of chars that are Latin characters that do not fall in the us-ascii range. In other words, the 8bit Latin chars.

### CkString.NumThai

`Chilkat 11.7.0 · dataflex · CkString · NumThai · property · read-only · since 9.5.0.25`

```dataflex
Function ComNumThai Returns Integer
```

The number of Thai characters contained in this string.

### CkString.SizeAnsi

`Chilkat 11.7.0 · dataflex · CkString · SizeAnsi · property · read-only`

```dataflex
Function ComSizeAnsi Returns Integer
```

The size, in bytes, of the ANSI encoding of the string.

### CkString.SizeUtf8

`Chilkat 11.7.0 · dataflex · CkString · SizeUtf8 · property · read-only`

```dataflex
Function ComSizeUtf8 Returns Integer
```

The size, in bytes, of the utf-8 encoding of the string.

### CkString.Str

`Chilkat 11.7.0 · dataflex · CkString · Str · property · read/write`

```dataflex
Function ComStr Returns String
Procedure Set ComStr String value
```

The string value of this object.

## Methods

### CkString.AnsiCharAt

`Chilkat 11.7.0 · dataflex · CkString · AnsiCharAt · method`

```dataflex
Function ComAnsiCharAt Integer index Returns Integer
```

Returns the ASCII value of the Nth char in the string. The 1st char is at index 0.

### CkString.Append

`Chilkat 11.7.0 · dataflex · CkString · Append · method`

```dataflex
Procedure ComAppend String str
```

The `str` is appended to end of this instance.

### CkString.AppendDateRfc3339

`Chilkat 11.7.0 · dataflex · CkString · AppendDateRfc3339 · method`

```dataflex
Procedure ComAppendDateRfc3339 DateTime dt
```

Appends a date/time string in RFC 3339 format to the end of this instance.

### CkString.AppendDateRfc822

`Chilkat 11.7.0 · dataflex · CkString · AppendDateRfc822 · method`

```dataflex
Procedure ComAppendDateRfc822 DateTime dt
```

The `dt` is appended in RFC 822 format to the end of this instance.

### CkString.AppendEncoded

`Chilkat 11.7.0 · dataflex · CkString · AppendEncoded · method`

```dataflex
Procedure ComAppendEncoded String str String encoding String charset
```

**Full documentation for this method (same in every language):** [Supported Character Encodings](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Appends characters from an encoded string. The encoding may be `base64`, `hex`, `url`, or `quoted-printable`. For example, to append `ABC 123` from a URL-encoded string, call:

```
strObj.AppendEncoded(ABC+123,url,iso-8859-1)
```

### CkString.AppendMultibyte

`Chilkat 11.7.0 · dataflex · CkString · AppendMultibyte · method`

```dataflex
Procedure ComAppendMultibyte Variant mbtext String charsetEncoding
```

**Full documentation for this method (same in every language):** [Supported Character Encodings](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Appends characters from a byte array. `mbtext` contains the character data. The input bytes are interpreted according to the character encoding specified by `charsetEncoding`.

### CkString.AppendToFile

`Chilkat 11.7.0 · dataflex · CkString · AppendToFile · method`

```dataflex
Function ComAppendToFile String path String charsetEncoding Returns Boolean
```

**Full documentation for this method (same in every language):** [Supported Character Encodings](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Appends the contents of the string to a file. The string is first converted to the character encoding specified by `charsetEncoding` before being appended to the file.

### CkString.BeginsWith

`Chilkat 11.7.0 · dataflex · CkString · BeginsWith · method`

```dataflex
Function ComBeginsWith String str Returns Boolean
```

Returns `True` if the string begins with `str`. Otherwise returns `False`. This method is case sensitive.

### CkString.ChopAfter

`Chilkat 11.7.0 · dataflex · CkString · ChopAfter · method`

```dataflex
Procedure ComChopAfter String findStr
```

Truncates the string after the 1st occurrence of `findStr`. If `findStr` is not present, nothing is truncated.

### CkString.ChopBefore

`Chilkat 11.7.0 · dataflex · CkString · ChopBefore · method`

```dataflex
Procedure ComChopBefore String findStr
```

Truncates the string before the 1st occurrence of `findStr`. If `findStr` is not present, nothing is truncated.

### CkString.Clear

`Chilkat 11.7.0 · dataflex · CkString · Clear · method`

```dataflex
Procedure ComClear
```

Clears the string. After calling this method, the string contains 0 characters.

### CkString.Contains

`Chilkat 11.7.0 · dataflex · CkString · Contains · method`

```dataflex
Function ComContains String substr Returns Boolean
```

Returns `True` if `substr` is present in the string (case sensitive), otherwise returns `False`.

### CkString.EmitMultibyte

`Chilkat 11.7.0 · dataflex · CkString · EmitMultibyte · method`

```dataflex
Function ComEmitMultibyte String charsetEncoding Returns Variant
```

**Full documentation for this method (same in every language):** [Supported Character Encodings](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Converts the string to a byte array using the character encoding specified by `charsetEncoding`.

Returns `null` on failure

### CkString.EndsWith

`Chilkat 11.7.0 · dataflex · CkString · EndsWith · method`

```dataflex
Function ComEndsWith String substr Returns Boolean
```

Returns `True` if the string ends with `substr` (case-sensitive). Otherwise returns `False`.

### CkString.GetEncoded

`Chilkat 11.7.0 · dataflex · CkString · GetEncoded · method`

```dataflex
Function ComGetEncoded String binaryEncoding String charsetEncoding Returns String
```

**Full documentation for this method (same in every language):** [Supported Character Encodings](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Returns the character string in an encoding use the `charsetEncoding` specified. The `binaryEncoding` may be `base64`, `hex`, `url`, or `quoted-printable`. For example:

```
(Visual Basic 6.0)

Dim s As New CkString

s.Str = Ã¨Ã¨Ã¨
Text1.Text = s.GetEncoded(hex, iso-8859-1) & vbCrLf
Text1.Text = Text.Text & s.GetEncoded(hex, utf-8) & vbCrLf
Text1.Text = Text1.Text & s.GetEncoded(hex, unicode)

'Output:
'E8E8E8
'C3A8C3A8C3A8
'E800E800E800
```

Returns `null` on failure

### CkString.HtmlEntityDecode

`Chilkat 11.7.0 · dataflex · CkString · HtmlEntityDecode · method`

```dataflex
Procedure ComHtmlEntityDecode
```

Decodes any HTML entities found in the string.

### CkString.HtmlEntityEncode

`Chilkat 11.7.0 · dataflex · CkString · HtmlEntityEncode · method`

```dataflex
Procedure ComHtmlEntityEncode
```

HTML entity encodes all special characters. (Those characters that might require HTML entity encoding.)

### CkString.LastAnsiChar

`Chilkat 11.7.0 · dataflex · CkString · LastAnsiChar · method`

```dataflex
Function ComLastAnsiChar Returns Integer
```

Returns the ASCII value of the last character in the string.

### CkString.Left

`Chilkat 11.7.0 · dataflex · CkString · Left · method`

```dataflex
Function ComLeft Integer numChars Returns String
```

Returns a string that is the leftmost `numChars` of this instance.

Returns `null` on failure

### CkString.Length

`Chilkat 11.7.0 · dataflex · CkString · Length · method`

```dataflex
Function ComLength Returns Integer
```

Returns the length, in characters, of the string.

### CkString.LoadFile

`Chilkat 11.7.0 · dataflex · CkString · LoadFile · method`

```dataflex
Function ComLoadFile String path String charsetEncoding Returns Boolean
```

**Full documentation for this method (same in every language):** [Supported Character Encodings](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Loads an entire text file into the string object. The character encoding of the text file is specified by `charsetEncoding`. This method allows for text files in any charset to be loaded: utf-8, Unicode, Shift_JIS, iso-8859-1, etc.

### CkString.LoadXmlDoc

`Chilkat 11.7.0 · dataflex · CkString · LoadXmlDoc · method`

```dataflex
Procedure ComLoadXmlDoc Variant xmlDocumentBytes
```

Loads an XML document into the CkString. The `xmlDocumentBytes` contains the raw bytes of the XML document. The reason for providing a separate method for loading an XML document is because the charset encoding is usually specified using a `charset` attribute at the beginning of the XML document. The LoadXmlDoc method reads just enough of the XML document to get the charset, and then it knows how to read and interpret the bytes of the entire XML document, so that the bytes of the characters are properly interpeted and loaded into the CkString object.

### CkString.Matches

`Chilkat 11.7.0 · dataflex · CkString · Matches · method`

```dataflex
Function ComMatches String strPattern Boolean caseSensitive Returns Boolean
```

Returns `True` if the string matches the `strPattern`, which may contain one or more asterisk wildcard characters. Case-sensitivity is controlled by , where 1 = case sensitive, 0 = case insensitive.

### CkString.Mid

`Chilkat 11.7.0 · dataflex · CkString · Mid · method`

```dataflex
Function ComMid Integer index Integer numChars Returns String
```

Same as the VB/VBScript `Mid` function, except that the 1st char is at index 0 (i.e. it is not 1-based). Returns a substring of length `numChars` starting at `index`.

Returns `null` on failure

### CkString.ParseDateRfc3339

`Chilkat 11.7.0 · dataflex · CkString · ParseDateRfc3339 · method`

```dataflex
Function ComParseDateRfc3339 Returns DateTime
```

Converts the date string (in RFC 3339 format) to a Date type.

### CkString.ParseDateRfc822

`Chilkat 11.7.0 · dataflex · CkString · ParseDateRfc822 · method`

```dataflex
Function ComParseDateRfc822 Returns DateTime
```

Converts the date string (in RFC 822 format) to a Date type.

### CkString.Pluralize

`Chilkat 11.7.0 · dataflex · CkString · Pluralize · method`

```dataflex
Procedure ComPluralize
```

Pluralizes an English word.

### CkString.Prepend

`Chilkat 11.7.0 · dataflex · CkString · Prepend · method`

```dataflex
Procedure ComPrepend String str
```

Prepends `str` to this instance.

### CkString.PunyDecode

`Chilkat 11.7.0 · dataflex · CkString · PunyDecode · method · since 9.5.0.52`

```dataflex
Procedure ComPunyDecode
```

In-place decodes the string from punycode.

### CkString.PunyEncode

`Chilkat 11.7.0 · dataflex · CkString · PunyEncode · method · since 9.5.0.52`

```dataflex
Procedure ComPunyEncode
```

In-place encodes the string to punycode.

### CkString.RemoveAnsiChar

`Chilkat 11.7.0 · dataflex · CkString · RemoveAnsiChar · method`

```dataflex
Procedure ComRemoveAnsiChar Integer ch
```

Removes all occurrences of `ch` from the string.

### CkString.ReplaceAll

`Chilkat 11.7.0 · dataflex · CkString · ReplaceAll · method`

```dataflex
Procedure ComReplaceAll String findStr String replaceStr
```

Replaces all occurrences of `findStr` with `replaceStr`. (case sensitive)

### CkString.ReplaceAnsiChar

`Chilkat 11.7.0 · dataflex · CkString · ReplaceAnsiChar · method`

```dataflex
Procedure ComReplaceAnsiChar Integer findCh Integer replaceCh
```

Replaces all occurrences of `findCh` with `replaceCh`.

### CkString.ReplaceFirst

`Chilkat 11.7.0 · dataflex · CkString · ReplaceFirst · method`

```dataflex
Procedure ComReplaceFirst String findStr String replaceStr
```

Replaces the first occurrence of `findStr` with `replaceStr`. (case sensitive)

### CkString.Right

`Chilkat 11.7.0 · dataflex · CkString · Right · method`

```dataflex
Function ComRight Integer numChars Returns String
```

Returns a string that is the rightmost `numChars` of this instance.

Returns `null` on failure

### CkString.SaveToFile

`Chilkat 11.7.0 · dataflex · CkString · SaveToFile · method`

```dataflex
Function ComSaveToFile String path String charsetEncoding Returns Boolean
```

**Full documentation for this method (same in every language):** [Supported Character Encodings](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Saves the string to a file, using the character encoding specified by `charsetEncoding`. This method allows for the string to be saved using character encodings such as `utf-8`, `Unicode`, `Shift-JIS`, or anything else...

Returns True for success, False for failure.

### CkString.Shorten

`Chilkat 11.7.0 · dataflex · CkString · Shorten · method`

```dataflex
Procedure ComShorten Integer numChars
```

Removes the final `numChars` from the string.

### CkString.StrComp

`Chilkat 11.7.0 · dataflex · CkString · StrComp · method`

```dataflex
Function ComStrComp String str Boolean caseSensitive Returns Integer
```

Lexicographically compares two strings. Returns 0 if both strings are equal. A value greater than zero indicates that the first character that does not match has a greater value in the caller's string than in `str`; And a value less than zero indicates the opposite.

### CkString.StripHtml

`Chilkat 11.7.0 · dataflex · CkString · StripHtml · method`

```dataflex
Procedure ComStripHtml
```

Strips HTML tags from a string.

### CkString.ToCRLF

`Chilkat 11.7.0 · dataflex · CkString · ToCRLF · method`

```dataflex
Procedure ComToCRLF
```

Converts all line endings to CRLF.

### CkString.ToLF

`Chilkat 11.7.0 · dataflex · CkString · ToLF · method`

```dataflex
Procedure ComToLF
```

Converts all line endings to bare-LF (Unix/Linux style).

### CkString.Trim

`Chilkat 11.7.0 · dataflex · CkString · Trim · method`

```dataflex
Procedure ComTrim
```

Trim SPACE and Tab characters from both ends of the string.

### CkString.Trim2

`Chilkat 11.7.0 · dataflex · CkString · Trim2 · method`

```dataflex
Procedure ComTrim2
```

Trim SPACE, Tab, CR, and LF characters from both ends of the string.

### CkString.TrimInside

`Chilkat 11.7.0 · dataflex · CkString · TrimInside · method`

```dataflex
Procedure ComTrimInside
```

Replaces all tabs, CR's, and LF's, with SPACE chars, and removes extra SPACE's so there are no occurrences of more than one SPACE char in a row.

### CkString.Unpluralize

`Chilkat 11.7.0 · dataflex · CkString · Unpluralize · method`

```dataflex
Procedure ComUnpluralize
```

Unpluralizes an English word.

