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

> Chilkat 11.7.0 · language=foxpro · 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/foxpro/guide.md`.

## Purpose

The Chilkat string class.

## Object creation, unlocking and error handling

**Object Creation**

```foxpro
loCkString = CreateObject('Chilkat.CkString')
```

Visual FoxPro is a 32-bit application and therefore uses the 32-bit Chilkat ActiveX. To bind to a specific major version of Chilkat, append the major version number to the ProgID, such as `CreateObject('Chilkat.CkString.11')` for Chilkat v11.\*.\*.

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

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 | `NumArabic As Number (read-only)` |
| `NumAscii` | property, read-only | `NumAscii As Number (read-only)` |
| `NumCentralEuro` | property, read-only | `NumCentralEuro As Number (read-only)` |
| `NumChars` | property, read-only | `NumChars As Number (read-only)` |
| `NumChinese` | property, read-only | `NumChinese As Number (read-only)` |
| `NumCyrillic` | property, read-only | `NumCyrillic As Number (read-only)` |
| `NumGreek` | property, read-only | `NumGreek As Number (read-only)` |
| `NumHebrew` | property, read-only | `NumHebrew As Number (read-only)` |
| `NumJapanese` | property, read-only | `NumJapanese As Number (read-only)` |
| `NumKorean` | property, read-only | `NumKorean As Number (read-only)` |
| `NumLatin` | property, read-only | `NumLatin As Number (read-only)` |
| `NumThai` | property, read-only | `NumThai As Number (read-only)` |
| `SizeAnsi` | property, read-only | `SizeAnsi As Number (read-only)` |
| `SizeUtf8` | property, read-only | `SizeUtf8 As Number (read-only)` |
| `Str` | property, read/write | `Str As String` |
| `AnsiCharAt` | method | `AnsiCharAt(index As Number) As Number` |
| `Append` | method | `Append(str As String)` |
| `AppendDateRfc3339` | method | `AppendDateRfc3339(dt As DateTime)` |
| `AppendDateRfc822` | method | `AppendDateRfc822(dt As DateTime)` |
| `AppendEncoded` | method | `AppendEncoded(str As String, encoding As String, charset As String)` |
| `AppendMultibyte` | method | `AppendMultibyte(mbtext As Variant, charsetEncoding As String)` |
| `AppendToFile` | method | `AppendToFile(path As String, charsetEncoding As String) As Number` |
| `BeginsWith` | method | `BeginsWith(str As String) As Number` |
| `ChopAfter` | method | `ChopAfter(findStr As String)` |
| `ChopBefore` | method | `ChopBefore(findStr As String)` |
| `Clear` | method | `Clear()` |
| `Contains` | method | `Contains(substr As String) As Number` |
| `EmitMultibyte` | method | `EmitMultibyte(charsetEncoding As String) As Variant` |
| `EndsWith` | method | `EndsWith(substr As String) As Number` |
| `GetEncoded` | method | `GetEncoded(binaryEncoding As String, charsetEncoding As String) As String` |
| `HtmlEntityDecode` | method | `HtmlEntityDecode()` |
| `HtmlEntityEncode` | method | `HtmlEntityEncode()` |
| `LastAnsiChar` | method | `LastAnsiChar() As Number` |
| `Left` | method | `Left(numChars As Number) As String` |
| `Length` | method | `Length() As Number` |
| `LoadFile` | method | `LoadFile(path As String, charsetEncoding As String) As Number` |
| `LoadXmlDoc` | method | `LoadXmlDoc(xmlDocumentBytes As Variant)` |
| `Matches` | method | `Matches(strPattern As String, caseSensitive As Number) As Number` |
| `Mid` | method | `Mid(index As Number, numChars As Number) As String` |
| `ParseDateRfc3339` | method | `ParseDateRfc3339() As DateTime` |
| `ParseDateRfc822` | method | `ParseDateRfc822() As DateTime` |
| `Pluralize` | method | `Pluralize()` |
| `Prepend` | method | `Prepend(str As String)` |
| `PunyDecode` | method | `PunyDecode()` |
| `PunyEncode` | method | `PunyEncode()` |
| `RemoveAnsiChar` | method | `RemoveAnsiChar(ch As Number)` |
| `ReplaceAll` | method | `ReplaceAll(findStr As String, replaceStr As String)` |
| `ReplaceAnsiChar` | method | `ReplaceAnsiChar(findCh As Number, replaceCh As Number)` |
| `ReplaceFirst` | method | `ReplaceFirst(findStr As String, replaceStr As String)` |
| `Right` | method | `Right(numChars As Number) As String` |
| `SaveToFile` | method | `SaveToFile(path As String, charsetEncoding As String) As Number` |
| `Shorten` | method | `Shorten(numChars As Number)` |
| `StrComp` | method | `StrComp(str As String, caseSensitive As Number) As Number` |
| `StripHtml` | method | `StripHtml()` |
| `ToCRLF` | method | `ToCRLF()` |
| `ToLF` | method | `ToLF()` |
| `Trim` | method | `Trim()` |
| `Trim2` | method | `Trim2()` |
| `TrimInside` | method | `TrimInside()` |
| `Unpluralize` | method | `Unpluralize()` |

## Properties

### CkString.NumArabic

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

```foxpro
NumArabic As Number (read-only)
```

The number of Arabic characters contained in this string.

### CkString.NumAscii

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

```foxpro
NumAscii As Number (read-only)
```

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

### CkString.NumCentralEuro

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

```foxpro
NumCentralEuro As Number (read-only)
```

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 · foxpro · CkString · NumChars · property · read-only`

```foxpro
NumChars As Number (read-only)
```

The number of characters in the string.

### CkString.NumChinese

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

```foxpro
NumChinese As Number (read-only)
```

The number of Chinese characters contained in this string.

### CkString.NumCyrillic

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

```foxpro
NumCyrillic As Number (read-only)
```

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 · foxpro · CkString · NumGreek · property · read-only · since 9.5.0.25`

```foxpro
NumGreek As Number (read-only)
```

The number of Greek characters contained in this string.

### CkString.NumHebrew

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

```foxpro
NumHebrew As Number (read-only)
```

The number of Hebrew characters contained in this string.

### CkString.NumJapanese

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

```foxpro
NumJapanese As Number (read-only)
```

The number of Japanese characters contained in this string.

### CkString.NumKorean

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

```foxpro
NumKorean As Number (read-only)
```

The number of Korean characters contained in this string.

### CkString.NumLatin

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

```foxpro
NumLatin As Number (read-only)
```

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 · foxpro · CkString · NumThai · property · read-only · since 9.5.0.25`

```foxpro
NumThai As Number (read-only)
```

The number of Thai characters contained in this string.

### CkString.SizeAnsi

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

```foxpro
SizeAnsi As Number (read-only)
```

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

### CkString.SizeUtf8

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

```foxpro
SizeUtf8 As Number (read-only)
```

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

### CkString.Str

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

```foxpro
Str As String
```

The string value of this object.

## Methods

### CkString.AnsiCharAt

`Chilkat 11.7.0 · foxpro · CkString · AnsiCharAt · method`

```foxpro
AnsiCharAt(index As Number) As Number
```

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

### CkString.Append

`Chilkat 11.7.0 · foxpro · CkString · Append · method`

```foxpro
Append(str As String)
```

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

### CkString.AppendDateRfc3339

`Chilkat 11.7.0 · foxpro · CkString · AppendDateRfc3339 · method`

```foxpro
AppendDateRfc3339(dt As DateTime)
```

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

### CkString.AppendDateRfc822

`Chilkat 11.7.0 · foxpro · CkString · AppendDateRfc822 · method`

```foxpro
AppendDateRfc822(dt As DateTime)
```

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

### CkString.AppendEncoded

`Chilkat 11.7.0 · foxpro · CkString · AppendEncoded · method`

```foxpro
AppendEncoded(str As String, encoding As String, charset As 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)

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 · foxpro · CkString · AppendMultibyte · method`

```foxpro
AppendMultibyte(mbtext As Variant, charsetEncoding As 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)

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 · foxpro · CkString · AppendToFile · method`

```foxpro
AppendToFile(path As String, charsetEncoding As String) As Number
```

**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 · foxpro · CkString · BeginsWith · method`

```foxpro
BeginsWith(str As String) As Number
```

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

### CkString.ChopAfter

`Chilkat 11.7.0 · foxpro · CkString · ChopAfter · method`

```foxpro
ChopAfter(findStr As String)
```

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

### CkString.ChopBefore

`Chilkat 11.7.0 · foxpro · CkString · ChopBefore · method`

```foxpro
ChopBefore(findStr As String)
```

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

### CkString.Clear

`Chilkat 11.7.0 · foxpro · CkString · Clear · method`

```foxpro
Clear()
```

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

### CkString.Contains

`Chilkat 11.7.0 · foxpro · CkString · Contains · method`

```foxpro
Contains(substr As String) As Number
```

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

### CkString.EmitMultibyte

`Chilkat 11.7.0 · foxpro · CkString · EmitMultibyte · method`

```foxpro
EmitMultibyte(charsetEncoding As String) As 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 a zero-length byte array (as a Variant) on failure.

### CkString.EndsWith

`Chilkat 11.7.0 · foxpro · CkString · EndsWith · method`

```foxpro
EndsWith(substr As String) As Number
```

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

### CkString.GetEncoded

`Chilkat 11.7.0 · foxpro · CkString · GetEncoded · method`

```foxpro
GetEncoded(binaryEncoding As String, charsetEncoding As String) As 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 · foxpro · CkString · HtmlEntityDecode · method`

```foxpro
HtmlEntityDecode()
```

Decodes any HTML entities found in the string.

### CkString.HtmlEntityEncode

`Chilkat 11.7.0 · foxpro · CkString · HtmlEntityEncode · method`

```foxpro
HtmlEntityEncode()
```

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

### CkString.LastAnsiChar

`Chilkat 11.7.0 · foxpro · CkString · LastAnsiChar · method`

```foxpro
LastAnsiChar() As Number
```

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

### CkString.Left

`Chilkat 11.7.0 · foxpro · CkString · Left · method`

```foxpro
Left(numChars As Number) As String
```

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

Returns `.NULL.` on failure

### CkString.Length

`Chilkat 11.7.0 · foxpro · CkString · Length · method`

```foxpro
Length() As Number
```

Returns the length, in characters, of the string.

### CkString.LoadFile

`Chilkat 11.7.0 · foxpro · CkString · LoadFile · method`

```foxpro
LoadFile(path As String, charsetEncoding As String) As Number
```

**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 · foxpro · CkString · LoadXmlDoc · method`

```foxpro
LoadXmlDoc(xmlDocumentBytes As Variant)
```

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 · foxpro · CkString · Matches · method`

```foxpro
Matches(strPattern As String, caseSensitive As Number) As Number
```

Returns `1` 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 · foxpro · CkString · Mid · method`

```foxpro
Mid(index As Number, numChars As Number) As 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 · foxpro · CkString · ParseDateRfc3339 · method`

```foxpro
ParseDateRfc3339() As DateTime
```

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

### CkString.ParseDateRfc822

`Chilkat 11.7.0 · foxpro · CkString · ParseDateRfc822 · method`

```foxpro
ParseDateRfc822() As DateTime
```

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

### CkString.Pluralize

`Chilkat 11.7.0 · foxpro · CkString · Pluralize · method`

```foxpro
Pluralize()
```

Pluralizes an English word.

### CkString.Prepend

`Chilkat 11.7.0 · foxpro · CkString · Prepend · method`

```foxpro
Prepend(str As String)
```

Prepends `str` to this instance.

### CkString.PunyDecode

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

```foxpro
PunyDecode()
```

In-place decodes the string from punycode.

### CkString.PunyEncode

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

```foxpro
PunyEncode()
```

In-place encodes the string to punycode.

### CkString.RemoveAnsiChar

`Chilkat 11.7.0 · foxpro · CkString · RemoveAnsiChar · method`

```foxpro
RemoveAnsiChar(ch As Number)
```

Removes all occurrences of `ch` from the string.

### CkString.ReplaceAll

`Chilkat 11.7.0 · foxpro · CkString · ReplaceAll · method`

```foxpro
ReplaceAll(findStr As String, replaceStr As String)
```

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

### CkString.ReplaceAnsiChar

`Chilkat 11.7.0 · foxpro · CkString · ReplaceAnsiChar · method`

```foxpro
ReplaceAnsiChar(findCh As Number, replaceCh As Number)
```

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

### CkString.ReplaceFirst

`Chilkat 11.7.0 · foxpro · CkString · ReplaceFirst · method`

```foxpro
ReplaceFirst(findStr As String, replaceStr As String)
```

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

### CkString.Right

`Chilkat 11.7.0 · foxpro · CkString · Right · method`

```foxpro
Right(numChars As Number) As String
```

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

Returns `.NULL.` on failure

### CkString.SaveToFile

`Chilkat 11.7.0 · foxpro · CkString · SaveToFile · method`

```foxpro
SaveToFile(path As String, charsetEncoding As String) As Number
```

**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 1 for success, 0 for failure.

### CkString.Shorten

`Chilkat 11.7.0 · foxpro · CkString · Shorten · method`

```foxpro
Shorten(numChars As Number)
```

Removes the final `numChars` from the string.

### CkString.StrComp

`Chilkat 11.7.0 · foxpro · CkString · StrComp · method`

```foxpro
StrComp(str As String, caseSensitive As Number) As Number
```

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 · foxpro · CkString · StripHtml · method`

```foxpro
StripHtml()
```

Strips HTML tags from a string.

### CkString.ToCRLF

`Chilkat 11.7.0 · foxpro · CkString · ToCRLF · method`

```foxpro
ToCRLF()
```

Converts all line endings to CRLF.

### CkString.ToLF

`Chilkat 11.7.0 · foxpro · CkString · ToLF · method`

```foxpro
ToLF()
```

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

### CkString.Trim

`Chilkat 11.7.0 · foxpro · CkString · Trim · method`

```foxpro
Trim()
```

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

### CkString.Trim2

`Chilkat 11.7.0 · foxpro · CkString · Trim2 · method`

```foxpro
Trim2()
```

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

### CkString.TrimInside

`Chilkat 11.7.0 · foxpro · CkString · TrimInside · method`

```foxpro
TrimInside()
```

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 · foxpro · CkString · Unpluralize · method`

```foxpro
Unpluralize()
```

Unpluralizes an English word.

