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

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

## Purpose

The Chilkat string class.

## Object creation, unlocking and error handling

**Object Creation**

```tcl
# 'this' is not a keyword in Tcl. It can freely be used as a variable name.
set this [new CkString]
```

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

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 | `integer set intVal [CkString_get_NumArabic $this]` |
| `NumAscii` | property, read-only | `integer set intVal [CkString_get_NumAscii $this]` |
| `NumCentralEuro` | property, read-only | `integer set intVal [CkString_get_NumCentralEuro $this]` |
| `NumChinese` | property, read-only | `integer set intVal [CkString_get_NumChinese $this]` |
| `NumCyrillic` | property, read-only | `integer set intVal [CkString_get_NumCyrillic $this]` |
| `NumGreek` | property, read-only | `integer set intVal [CkString_get_NumGreek $this]` |
| `NumHebrew` | property, read-only | `integer set intVal [CkString_get_NumHebrew $this]` |
| `NumJapanese` | property, read-only | `integer set intVal [CkString_get_NumJapanese $this]` |
| `NumKorean` | property, read-only | `integer set intVal [CkString_get_NumKorean $this]` |
| `NumLatin` | property, read-only | `integer set intVal [CkString_get_NumLatin $this]` |
| `NumThai` | property, read-only | `integer set intVal [CkString_get_NumThai $this]` |
| `append` | method | `# str is a string CkString_append $this $str` |
| `appendAnsi` | method | `# str is a string CkString_appendAnsi $this $str` |
| `appendChar` | method | `# c is a char CkString_appendChar $this $c` |
| `appendCurrentDateRfc822` | method | `CkString_appendCurrentDateRfc822 $this` |
| `appendEnc` | method | `# str is a string # charsetEncoding is a string CkString_appendEnc $this $str $charsetEncoding` |
| `appendInt` | method | `# n is an integer CkString_appendInt $this $n` |
| `appendN` | method | `# str is a string # numBytes is an integer CkString_appendN $this $str $numBytes` |
| `appendNU` | method | `# wideStr is a utf-16 string # numChars is an integer CkString_appendNU $this $wideStr $numChars` |
| `appendRandom` | method | `# numBytes is an integer # encoding is a string CkString_appendRandom $this $numBytes $encoding` |
| `appendStr` | method | `# strObj is a CkString CkString_appendStr $this $strObj` |
| `appendU` | method | `# unicode is a utf-16 string CkString_appendU $this $unicode` |
| `appendUtf8` | method | `# str is a string CkString_appendUtf8 $this $str` |
| `base64Decode` | method | `# charsetEncoding is a string CkString_base64Decode $this $charsetEncoding` |
| `base64DecodeW` | method | `# charsetEncoding is a utf-16 string CkString_base64DecodeW $this $charsetEncoding` |
| `base64Encode` | method | `# charsetEncoding is a string CkString_base64Encode $this $charsetEncoding` |
| `base64EncodeW` | method | `# charsetEncoding is a utf-16 string CkString_base64EncodeW $this $charsetEncoding` |
| `beginsWith` | method | `# substr is a string set retBool [CkString_beginsWith $this $substr]` |
| `beginsWithStr` | method | `# strObj is a CkString set retBool [CkString_beginsWithStr $this $strObj]` |
| `beginsWithW` | method | `# str is a utf-16 string set retBool [CkString_beginsWithW $this $str]` |
| `charAt` | method | `# idx is an integer set retChar [CkString_charAt $this $idx]` |
| `charAtU` | method | `# idx is an integer set utf16_char [CkString_charAtU $this $idx]` |
| `chopAtFirstChar` | method | `# ch is a char CkString_chopAtFirstChar $this $ch` |
| `chopAtStr` | method | `# subStrObj is a CkString CkString_chopAtStr $this $subStrObj` |
| `clear` | method | `CkString_clear $this` |
| `clone` | method | `# returns a CkString set ret_ckString [CkString_clone $this]` |
| `compareStr` | method | `# str is a CkString set retInt [CkString_compareStr $this $str]` |
| `containsSubstring` | method | `# substr is a string set retBool [CkString_containsSubstring $this $substr]` |
| `containsSubstringNoCase` | method | `# substr is a string set retBool [CkString_containsSubstringNoCase $this $substr]` |
| `containsSubstringNoCaseW` | method | `# substr is a utf-16 string set retBool [CkString_containsSubstringNoCaseW $this $substr]` |
| `containsSubstringW` | method | `# substr is a utf-16 string set retBool [CkString_containsSubstringW $this $substr]` |
| `countCharOccurances` | method | `# ch is a char set retInt [CkString_countCharOccurances $this $ch]` |
| `decodeXMLSpecial` | method | `CkString_decodeXMLSpecial $this` |
| `doubleValue` | method | `set retDouble [CkString_doubleValue $this]` |
| `eliminateChar` | method | `# ansiChar is a char # startIndex is an integer CkString_eliminateChar $this $ansiChar $startIndex` |
| `encodeXMLSpecial` | method | `CkString_encodeXMLSpecial $this` |
| `endsWith` | method | `# substr is a string set retBool [CkString_endsWith $this $substr]` |
| `endsWithStr` | method | `# substrObj is a CkString set retBool [CkString_endsWithStr $this $substrObj]` |
| `endsWithW` | method | `# s is a utf-16 string set retBool [CkString_endsWithW $this $s]` |
| `entityDecode` | method | `CkString_entityDecode $this` |
| `entityEncode` | method | `CkString_entityEncode $this` |
| `equals` | method | `# str is a string set retBool [CkString_equals $this $str]` |
| `equalsIgnoreCase` | method | `# str is a string set retBool [CkString_equalsIgnoreCase $this $str]` |
| `equalsIgnoreCaseStr` | method | `# strObj is a CkString set retBool [CkString_equalsIgnoreCaseStr $this $strObj]` |
| `equalsIgnoreCaseW` | method | `# s is a utf-16 string set retBool [CkString_equalsIgnoreCaseW $this $s]` |
| `equalsStr` | method | `# strObj is a CkString set retBool [CkString_equalsStr $this $strObj]` |
| `equalsW` | method | `# s is a utf-16 string set retBool [CkString_equalsW $this $s]` |
| `getChar` | method | `# returns a CkString # idx is an integer set ret_ckString [CkString_getChar $this $idx]` |
| `getNumChars` | method | `set retInt [CkString_getNumChars $this]` |
| `getSizeAnsi` | method | `set retInt [CkString_getSizeAnsi $this]` |
| `getSizeUnicode` | method | `set retInt [CkString_getSizeUnicode $this]` |
| `getSizeUtf8` | method | `set retInt [CkString_getSizeUtf8 $this]` |
| `getUnicode` | method | `set utf16_text [CkString_getUnicode $this]` |
| `hexDecode` | method | `# charsetEncoding is a string CkString_hexDecode $this $charsetEncoding` |
| `hexDecodeW` | method | `# charsetEncoding is a utf-16 string CkString_hexDecodeW $this $charsetEncoding` |
| `hexEncode` | method | `# charsetEncoding is a string CkString_hexEncode $this $charsetEncoding` |
| `hexEncodeW` | method | `# charsetEncoding is a utf-16 string CkString_hexEncodeW $this $charsetEncoding` |
| `indexOf` | method | `# substr is a string set retInt [CkString_indexOf $this $substr]` |
| `indexOfStr` | method | `# substrObj is a CkString set retInt [CkString_indexOfStr $this $substrObj]` |
| `indexOfW` | method | `# s is a utf-16 string set retInt [CkString_indexOfW $this $s]` |
| `intValue` | method | `set retInt [CkString_intValue $this]` |
| `isEmpty` | method | `set retBool [CkString_isEmpty $this]` |
| `lastChar` | method | `set retChar [CkString_lastChar $this]` |
| `loadFile` | method | `# path is a string # charsetEncoding is a string set status [CkString_loadFile $this $path $charsetEncoding]` |
| `loadFileW` | method | `# path is a utf-16 string # charsetEncoding is a utf-16 string set status [CkString_loadFileW $this $path $charsetEncoding]` |
| `matches` | method | `# strPattern is a string set retBool [CkString_matches $this $strPattern]` |
| `matchesNoCase` | method | `# strPattern is a string set retBool [CkString_matchesNoCase $this $strPattern]` |
| `matchesNoCaseW` | method | `# s is a utf-16 string set retBool [CkString_matchesNoCaseW $this $s]` |
| `matchesStr` | method | `# strPatternObj is a CkString set retBool [CkString_matchesStr $this $strPatternObj]` |
| `matchesW` | method | `# s is a utf-16 string set retBool [CkString_matchesW $this $s]` |
| `minimizeMemory` | method | `CkString_minimizeMemory $this` |
| `obfuscate` | method | `CkString_obfuscate $this` |
| `prepend` | method | `# str is a string CkString_prepend $this $str` |
| `prependW` | method | `# s is a utf-16 string CkString_prependW $this $s` |
| `punyDecode` | method | `CkString_punyDecode $this` |
| `punyEncode` | method | `CkString_punyEncode $this` |
| `qpDecode` | method | `# charsetEncoding is a string CkString_qpDecode $this $charsetEncoding` |
| `qpDecodeW` | method | `# charset is a utf-16 string CkString_qpDecodeW $this $charset` |
| `qpEncode` | method | `# charsetEncoding is a string CkString_qpEncode $this $charsetEncoding` |
| `qpEncodeW` | method | `# charset is a utf-16 string CkString_qpEncodeW $this $charset` |
| `removeAll` | method | `# substr is a CkString set retInt [CkString_removeAll $this $substr]` |
| `removeCharOccurances` | method | `# ch is a char CkString_removeCharOccurances $this $ch` |
| `removeChunk` | method | `# charStartPos is an integer # numChars is an integer CkString_removeChunk $this $charStartPos $numChars` |
| `removeDelimited` | method | `# beginDelim is a string # endDelim is a string # caseSensitive is a boolean CkString_removeDelimited $this $beginDelim $endDelim $caseSensitive` |
| `removeFirst` | method | `# substr is a CkString set retBool [CkString_removeFirst $this $substr]` |
| `replaceAll` | method | `# findStrObj is a CkString # replaceStrObj is a CkString set retInt [CkString_replaceAll $this $findStrObj $replaceStrObj]` |
| `replaceAllOccurances` | method | `# findStr is a string # replaceStr is a string set retInt [CkString_replaceAllOccurances $this $findStr $replaceStr]` |
| `replaceAllOccurancesW` | method | `# pattern is a utf-16 string # replacement is a utf-16 string set retInt [CkString_replaceAllOccurancesW $this $pattern $replacement]` |
| `replaceChar` | method | `# findCh is a char # replaceCh is a char CkString_replaceChar $this $findCh $replaceCh` |
| `replaceFirst` | method | `# findStrObj is a CkString # replaceStrObj is a CkString set retBool [CkString_replaceFirst $this $findStrObj $replaceStrObj]` |
| `replaceFirstOccurance` | method | `# findStr is a string # replaceStr is a string set retBool [CkString_replaceFirstOccurance $this $findStr $replaceStr]` |
| `replaceFirstOccuranceW` | method | `# pattern is a utf-16 string # replacement is a utf-16 string set retBool [CkString_replaceFirstOccuranceW $this $pattern $replacement]` |
| `saveToFile` | method | `# path is a string # charsetEncoding is a string set status [CkString_saveToFile $this $path $charsetEncoding]` |
| `saveToFileW` | method | `# path is a utf-16 string # charset is a utf-16 string set status [CkString_saveToFileW $this $path $charset]` |
| `setStr` | method | `# s is a CkString CkString_setStr $this $s` |
| `setString` | method | `# str is a string CkString_setString $this $str` |
| `setStringAnsi` | method | `# s is a string CkString_setStringAnsi $this $s` |
| `setStringU` | method | `# unicode is a utf-16 string CkString_setStringU $this $unicode` |
| `setStringUtf8` | method | `# s is a string CkString_setStringUtf8 $this $s` |
| `shorten` | method | `# n is an integer CkString_shorten $this $n` |
| `split` | method | `# returns a CkStringArray # delimiterChar is a char # exceptDoubleQuoted is a boolean # exceptEscaped is a boolean # keepEmpty is a boolean set ret_stringArray [CkString_split $this $delimiterChar $exceptDoubleQuoted $exceptEscaped $keepEmpty]` |
| `split2` | method | `# returns a CkStringArray # delimiterChars is a string # exceptDoubleQuoted is a boolean # exceptEscaped is a boolean # keepEmpty is a boolean set ret_stringArray [CkString_split2 $this $delimiterChars $exceptDoubleQuoted $exceptEscaped $keepEmpty]` |
| `split2W` | method | `# returns a CkStringArray # splitCharSet is a utf-16 string # exceptDoubleQuoted is a boolean # exceptEscaped is a boolean # keepEmpty is a boolean set ret_stringArray [CkString_split2W $this $splitCharSet $exceptDoubleQuoted $exceptEscaped $keepEmpty]` |
| `splitAtWS` | method | `# returns a CkStringArray set ret_stringArray [CkString_splitAtWS $this]` |
| `substring` | method | `# returns a CkString # startCharIndex is an integer # numChars is an integer set ret_ckString [CkString_substring $this $startCharIndex $numChars]` |
| `toCRLF` | method | `CkString_toCRLF $this` |
| `tokenize` | method | `# returns a CkStringArray # punctuation is a string set ret_stringArray [CkString_tokenize $this $punctuation]` |
| `tokenizeW` | method | `# returns a CkStringArray # punctuation is a utf-16 string set ret_stringArray [CkString_tokenizeW $this $punctuation]` |
| `toLF` | method | `CkString_toLF $this` |
| `toLowerCase` | method | `CkString_toLowerCase $this` |
| `toUpperCase` | method | `CkString_toUpperCase $this` |
| `trim` | method | `CkString_trim $this` |
| `trim2` | method | `CkString_trim2 $this` |
| `trimInsideSpaces` | method | `CkString_trimInsideSpaces $this` |
| `unobfuscate` | method | `CkString_unobfuscate $this` |
| `urlDecode` | method | `# charsetEncoding is a string CkString_urlDecode $this $charsetEncoding` |
| `urlDecodeW` | method | `# charsetEncoding is a utf-16 string CkString_urlDecodeW $this $charsetEncoding` |
| `urlEncode` | method | `# charsetEncoding is a string CkString_urlEncode $this $charsetEncoding` |
| `urlEncodeW` | method | `# charsetEncoding is a utf-16 string CkString_urlEncodeW $this $charsetEncoding` |

## Properties

### CkString.NumArabic

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

```tcl
integer
set intVal [CkString_get_NumArabic $this]
```

The number of Arabic characters contained in this string.

### CkString.NumAscii

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

```tcl
integer
set intVal [CkString_get_NumAscii $this]
```

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

### CkString.NumCentralEuro

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

```tcl
integer
set intVal [CkString_get_NumCentralEuro $this]
```

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

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

```tcl
integer
set intVal [CkString_get_NumChinese $this]
```

The number of Chinese characters contained in this string.

### CkString.NumCyrillic

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

```tcl
integer
set intVal [CkString_get_NumCyrillic $this]
```

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

```tcl
integer
set intVal [CkString_get_NumGreek $this]
```

The number of Greek characters contained in this string.

### CkString.NumHebrew

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

```tcl
integer
set intVal [CkString_get_NumHebrew $this]
```

The number of Hebrew characters contained in this string.

### CkString.NumJapanese

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

```tcl
integer
set intVal [CkString_get_NumJapanese $this]
```

The number of Japanese characters contained in this string.

### CkString.NumKorean

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

```tcl
integer
set intVal [CkString_get_NumKorean $this]
```

The number of Korean characters contained in this string.

### CkString.NumLatin

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

```tcl
integer
set intVal [CkString_get_NumLatin $this]
```

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

```tcl
integer
set intVal [CkString_get_NumThai $this]
```

The number of Thai characters contained in this string.

## Methods

### CkString.append

`Chilkat 11.7.0 · tcl · CkString · append · method`

```tcl
# str is a string

CkString_append $this $str
```

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

### CkString.appendAnsi

`Chilkat 11.7.0 · tcl · CkString · appendAnsi · method`

```tcl
# str is a string

CkString_appendAnsi $this $str
```

Appends an ANSI string to the end of this instance. `str` should always be a null terminated ANSI string regardless of the Utf8 property setting.

### CkString.appendChar

`Chilkat 11.7.0 · tcl · CkString · appendChar · method`

```tcl
# c is a char

CkString_appendChar $this $c
```

Appends a single ANSI character to the end of this instance.

### CkString.appendCurrentDateRfc822

`Chilkat 11.7.0 · tcl · CkString · appendCurrentDateRfc822 · method`

```tcl
CkString_appendCurrentDateRfc822 $this
```

Appends the current date/time to the end of this instance. The date/time is formatted according to the RFC822 standard, which is the typical format used in the `Date` header field of email. For example: `Fri, 27 Jul 2012 17:41:41 -0500`

### CkString.appendEnc

`Chilkat 11.7.0 · tcl · CkString · appendEnc · method`

```tcl
# str is a string

# charsetEncoding is a string

CkString_appendEnc $this $str  $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 a string of any character encoding to the end of this instance. Examples of `charsetEncoding` are: Shift_JIS, windows-1255, iso-8859-2, gb2312, etc. The `str` should point to a null-terminated string that uses the charset specified by `charsetEncoding`.

### CkString.appendInt

`Chilkat 11.7.0 · tcl · CkString · appendInt · method`

```tcl
# n is an integer

CkString_appendInt $this $n
```

Appends the decimal string representation of an integer to the end of this instance.

### CkString.appendN

`Chilkat 11.7.0 · tcl · CkString · appendN · method`

```tcl
# str is a string

# numBytes is an integer

CkString_appendN $this $str  $numBytes
```

Appends N bytes of character data to the end of this instance. If the Utf8 property is set to `1`, then `str` should point to characters in the utf-8 encoding, otherwise it should point to characters using the ANSI encoding. Note: `numBytes` is not necessarily the number of characters. It is the length, in bytes, of the string to be appended. This method exists to allow for non-null terminated strings to be appended.

### CkString.appendNU

`Chilkat 11.7.0 · tcl · CkString · appendNU · method`

```tcl
# wideStr is a utf-16 string

# numChars is an integer

CkString_appendNU $this $wideStr  $numChars
```

Append N Unicode characters to the end of this instance. The `wideStr` points to the 2-byte per char Unicode string. The `numChars` is the number of Unicode characters to be appended (not the number of bytes).

### CkString.appendRandom

`Chilkat 11.7.0 · tcl · CkString · appendRandom · method`

```tcl
# numBytes is an integer

# encoding is a string

CkString_appendRandom $this $numBytes  $encoding
```

Appends `numBytes` random bytes to the end of this instance. Because arbitrary byte values in the range 0 to 255 do not necessarily represent valid characters, the bytes must be encoded to a string friendly representation such as hex, base64, etc. The `encoding` specifies the encoding to be used. Possible values are `hex`, `base64`, `quoted-printable`, `asc`, or `url`.

### CkString.appendStr

`Chilkat 11.7.0 · tcl · CkString · appendStr · method`

```tcl
# strObj is a CkString

CkString_appendStr $this $strObj
```

Appends the contents of `strObj` to the end of this instance.

### CkString.appendU

`Chilkat 11.7.0 · tcl · CkString · appendU · method`

```tcl
# unicode is a utf-16 string

CkString_appendU $this $unicode
```

Append a Unicode string to the CkString object.

### CkString.appendUtf8

`Chilkat 11.7.0 · tcl · CkString · appendUtf8 · method`

```tcl
# str is a string

CkString_appendUtf8 $this $str
```

Appends a utf-8 string to the existing contents of this instance. `str` should always be a null terminated utf-8 string regardless of the Utf8 property setting.

### CkString.base64Decode

`Chilkat 11.7.0 · tcl · CkString · base64Decode · method`

```tcl
# charsetEncoding is a string

CkString_base64Decode $this $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)

In-place base64 decodes the string and inteprets the results according to the character encoding specified.

### CkString.base64DecodeW

`Chilkat 11.7.0 · tcl · CkString · base64DecodeW · method`

```tcl
# charsetEncoding is a utf-16 string

CkString_base64DecodeW $this $charsetEncoding
```

The utf-16 version of base64Decode.

### CkString.base64Encode

`Chilkat 11.7.0 · tcl · CkString · base64Encode · method`

```tcl
# charsetEncoding is a string

CkString_base64Encode $this $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)

In-place base64 encodes the string. Internally, the string is first converted to the character encoding specified and then base-64 encoded. Typical `charsetEncoding` values are `utf-8`, `ANSI`, `iso-8859-1`, etc.

### CkString.base64EncodeW

`Chilkat 11.7.0 · tcl · CkString · base64EncodeW · method`

```tcl
# charsetEncoding is a utf-16 string

CkString_base64EncodeW $this $charsetEncoding
```

The utf-16 version of base64Encode.

### CkString.beginsWith

`Chilkat 11.7.0 · tcl · CkString · beginsWith · method`

```tcl
# substr is a string

set retBool [CkString_beginsWith $this $substr]
```

Return `1` if this string begins with `substr` (case sensitive), otherwise returns `0`.

### CkString.beginsWithStr

`Chilkat 11.7.0 · tcl · CkString · beginsWithStr · method`

```tcl
# strObj is a CkString

set retBool [CkString_beginsWithStr $this $strObj]
```

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

### CkString.beginsWithW

`Chilkat 11.7.0 · tcl · CkString · beginsWithW · method`

```tcl
# str is a utf-16 string

set retBool [CkString_beginsWithW $this $str]
```

The utf-16 version of beginsWith.

### CkString.charAt

`Chilkat 11.7.0 · tcl · CkString · charAt · method`

```tcl
# idx is an integer

set retChar [CkString_charAt $this $idx]
```

Returns the ANSI character at a specified index.The first character is at index 0.

### CkString.charAtU

`Chilkat 11.7.0 · tcl · CkString · charAtU · method`

```tcl
# idx is an integer

set utf16_char [CkString_charAtU $this $idx]
```

Return the Nth character as a Unicode character.

### CkString.chopAtFirstChar

`Chilkat 11.7.0 · tcl · CkString · chopAtFirstChar · method`

```tcl
# ch is a char

CkString_chopAtFirstChar $this $ch
```

Finds the first occurrence of `ch` and discards the characters at and following `ch`.

### CkString.chopAtStr

`Chilkat 11.7.0 · tcl · CkString · chopAtStr · method`

```tcl
# subStrObj is a CkString

CkString_chopAtStr $this $subStrObj
```

Finds the first occurrence of a substring and chops it at that point. The result is that the substring and all subsequent characters are removed from the string.

### CkString.clear

`Chilkat 11.7.0 · tcl · CkString · clear · method`

```tcl
CkString_clear $this
```

Clears the string. The string contains 0 characters after calling this method.

### CkString.clone

`Chilkat 11.7.0 · tcl · CkString · clone · method`

```tcl
# returns a CkString

set ret_ckString [CkString_clone $this]
```

Creates a copy of the string. As with any newly created Chilkat object instance returned by a Chilkat method, the returned CkString object must be deleted by the calling application.

Returns `NULL` on failure

### CkString.compareStr

`Chilkat 11.7.0 · tcl · CkString · compareStr · method`

```tcl
# str is a CkString

set retInt [CkString_compareStr $this $str]
```

Compare two strings. A return value = 0 means they are equal. Return value = 1 indicates that calling object is lexicographically less than argument. Return value = -1 indicates that calling object is lexicographically greater than argument.

### CkString.containsSubstring

`Chilkat 11.7.0 · tcl · CkString · containsSubstring · method`

```tcl
# substr is a string

set retBool [CkString_containsSubstring $this $substr]
```

Returns `1` if the string contains the specified substring, otherwise returns `0`. The string comparison is case-sensitive.

### CkString.containsSubstringNoCase

`Chilkat 11.7.0 · tcl · CkString · containsSubstringNoCase · method`

```tcl
# substr is a string

set retBool [CkString_containsSubstringNoCase $this $substr]
```

Same as containsSubstring except the matching is case insensitive.

### CkString.containsSubstringNoCaseW

`Chilkat 11.7.0 · tcl · CkString · containsSubstringNoCaseW · method`

```tcl
# substr is a utf-16 string

set retBool [CkString_containsSubstringNoCaseW $this $substr]
```

The utf-16 version of containsSubstringNoCase.

### CkString.containsSubstringW

`Chilkat 11.7.0 · tcl · CkString · containsSubstringW · method`

```tcl
# substr is a utf-16 string

set retBool [CkString_containsSubstringW $this $substr]
```

The utf-16 version of containsSubstring.

### CkString.countCharOccurances

`Chilkat 11.7.0 · tcl · CkString · countCharOccurances · method`

```tcl
# ch is a char

set retInt [CkString_countCharOccurances $this $ch]
```

Returns the number of occurrences of the specified ANSI char.

### CkString.decodeXMLSpecial

`Chilkat 11.7.0 · tcl · CkString · decodeXMLSpecial · method`

```tcl
CkString_decodeXMLSpecial $this
```

Decodes XML special characters. For example, < is converted to '<'

### CkString.doubleValue

`Chilkat 11.7.0 · tcl · CkString · doubleValue · method`

```tcl
set retDouble [CkString_doubleValue $this]
```

Converts the string to a double and returns the value.

### CkString.eliminateChar

`Chilkat 11.7.0 · tcl · CkString · eliminateChar · method`

```tcl
# ansiChar is a char

# startIndex is an integer

CkString_eliminateChar $this $ansiChar  $startIndex
```

Eliminate all occurrences of a particular ANSI character.

### CkString.encodeXMLSpecial

`Chilkat 11.7.0 · tcl · CkString · encodeXMLSpecial · method`

```tcl
CkString_encodeXMLSpecial $this
```

Encodes XML special characters. For example, '<' is converted to <

### CkString.endsWith

`Chilkat 11.7.0 · tcl · CkString · endsWith · method`

```tcl
# substr is a string

set retBool [CkString_endsWith $this $substr]
```

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

### CkString.endsWithStr

`Chilkat 11.7.0 · tcl · CkString · endsWithStr · method`

```tcl
# substrObj is a CkString

set retBool [CkString_endsWithStr $this $substrObj]
```

Returns `1` if the string ends with the specified substring, otherwise returns `0`.

### CkString.endsWithW

`Chilkat 11.7.0 · tcl · CkString · endsWithW · method`

```tcl
# s is a utf-16 string

set retBool [CkString_endsWithW $this $s]
```

The utf-16 version of endsWith.

### CkString.entityDecode

`Chilkat 11.7.0 · tcl · CkString · entityDecode · method`

```tcl
CkString_entityDecode $this
```

Decodes any HTML entities found within the string, replacing them with the characters represented.

### CkString.entityEncode

`Chilkat 11.7.0 · tcl · CkString · entityEncode · method`

```tcl
CkString_entityEncode $this
```

HTML encodes any characters that are special to HTML or cannot be represented by 7-bit us-ascii.

### CkString.equals

`Chilkat 11.7.0 · tcl · CkString · equals · method`

```tcl
# str is a string

set retBool [CkString_equals $this $str]
```

Returns `1` if the strings are equal, otherwise returns `0`. (case-sensitive)

### CkString.equalsIgnoreCase

`Chilkat 11.7.0 · tcl · CkString · equalsIgnoreCase · method`

```tcl
# str is a string

set retBool [CkString_equalsIgnoreCase $this $str]
```

Returns `1` if the strings are equal, otherwise returns `0`. (case-insensitive)

### CkString.equalsIgnoreCaseStr

`Chilkat 11.7.0 · tcl · CkString · equalsIgnoreCaseStr · method`

```tcl
# strObj is a CkString

set retBool [CkString_equalsIgnoreCaseStr $this $strObj]
```

Returns `1` if the strings are equal, otherwise returns `0` (case-insensitive)

### CkString.equalsIgnoreCaseW

`Chilkat 11.7.0 · tcl · CkString · equalsIgnoreCaseW · method`

```tcl
# s is a utf-16 string

set retBool [CkString_equalsIgnoreCaseW $this $s]
```

The utf-16 version of equalsIgnoreCase.

### CkString.equalsStr

`Chilkat 11.7.0 · tcl · CkString · equalsStr · method`

```tcl
# strObj is a CkString

set retBool [CkString_equalsStr $this $strObj]
```

Returns `1` if the strings are equal, otherwise returns `0`. (case-sensitive)

### CkString.equalsW

`Chilkat 11.7.0 · tcl · CkString · equalsW · method`

```tcl
# s is a utf-16 string

set retBool [CkString_equalsW $this $s]
```

The utf-16 version of the `equals` method.

### CkString.getChar

`Chilkat 11.7.0 · tcl · CkString · getChar · method`

```tcl
# returns a CkString

# idx is an integer

set ret_ckString [CkString_getChar $this $idx]
```

Returns a new CkString object containing the Nth character. (Note, it does not contain the Nth byte, but the Nth character.) For languages such as Chinese, Japanese, etc. individual characters are represented by multiple or varying number of bytes.

Returns `NULL` on failure

### CkString.getNumChars

`Chilkat 11.7.0 · tcl · CkString · getNumChars · method`

```tcl
set retInt [CkString_getNumChars $this]
```

Returns the number of characters in the string.

### CkString.getSizeAnsi

`Chilkat 11.7.0 · tcl · CkString · getSizeAnsi · method`

```tcl
set retInt [CkString_getSizeAnsi $this]
```

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

### CkString.getSizeUnicode

`Chilkat 11.7.0 · tcl · CkString · getSizeUnicode · method`

```tcl
set retInt [CkString_getSizeUnicode $this]
```

Returns the size, in bytes, of the Unicode encoding of the string.

### CkString.getSizeUtf8

`Chilkat 11.7.0 · tcl · CkString · getSizeUtf8 · method`

```tcl
set retInt [CkString_getSizeUtf8 $this]
```

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

### CkString.getUnicode

`Chilkat 11.7.0 · tcl · CkString · getUnicode · method`

```tcl
set utf16_text [CkString_getUnicode $this]
```

Return a pointer to memory containing the string in Unicode.

### CkString.hexDecode

`Chilkat 11.7.0 · tcl · CkString · hexDecode · method`

```tcl
# charsetEncoding is a string

CkString_hexDecode $this $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)

Hex decodes a string and inteprets the bytes according to the character encoding specified.

### CkString.hexDecodeW

`Chilkat 11.7.0 · tcl · CkString · hexDecodeW · method`

```tcl
# charsetEncoding is a utf-16 string

CkString_hexDecodeW $this $charsetEncoding
```

The utf-16 version of hexDecode.

### CkString.hexEncode

`Chilkat 11.7.0 · tcl · CkString · hexEncode · method`

```tcl
# charsetEncoding is a string

CkString_hexEncode $this $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)

Converts the string to the character encoding specified and replaces the string contents with the hex encoding of the character data.

### CkString.hexEncodeW

`Chilkat 11.7.0 · tcl · CkString · hexEncodeW · method`

```tcl
# charsetEncoding is a utf-16 string

CkString_hexEncodeW $this $charsetEncoding
```

The utf-16 version of hexEncode.

### CkString.indexOf

`Chilkat 11.7.0 · tcl · CkString · indexOf · method`

```tcl
# substr is a string

set retInt [CkString_indexOf $this $substr]
```

Returns the index of the first occurrence of a substring. Returns -1 if not found.

### CkString.indexOfStr

`Chilkat 11.7.0 · tcl · CkString · indexOfStr · method`

```tcl
# substrObj is a CkString

set retInt [CkString_indexOfStr $this $substrObj]
```

Returns the index of the first occurrence of a substring. Returns -1 if not found.

### CkString.indexOfW

`Chilkat 11.7.0 · tcl · CkString · indexOfW · method`

```tcl
# s is a utf-16 string

set retInt [CkString_indexOfW $this $s]
```

The utf-16 version of `indexOf`.

### CkString.intValue

`Chilkat 11.7.0 · tcl · CkString · intValue · method`

```tcl
set retInt [CkString_intValue $this]
```

Converts the string to an integer and returns the integer value.

### CkString.isEmpty

`Chilkat 11.7.0 · tcl · CkString · isEmpty · method`

```tcl
set retBool [CkString_isEmpty $this]
```

Returns `1` if the string object is empty, otherwise returns `0`.

### CkString.lastChar

`Chilkat 11.7.0 · tcl · CkString · lastChar · method`

```tcl
set retChar [CkString_lastChar $this]
```

Returns the last ANSI character in the string.

### CkString.loadFile

`Chilkat 11.7.0 · tcl · CkString · loadFile · method`

```tcl
# path is a string

# charsetEncoding is a string

set status [CkString_loadFile $this $path  $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)

Load the contents of a text file into the CkString object. The string is cleared before loading. 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.

Returns 1 for success, 0 for failure.

### CkString.loadFileW

`Chilkat 11.7.0 · tcl · CkString · loadFileW · method`

```tcl
# path is a utf-16 string

# charsetEncoding is a utf-16 string

set status [CkString_loadFileW $this $path  $charsetEncoding]
```

The utf-16 version of loadFile.

Returns 1 for success, 0 for failure.

### CkString.matches

`Chilkat 11.7.0 · tcl · CkString · matches · method`

```tcl
# strPattern is a string

set retBool [CkString_matches $this $strPattern]
```

Returns `1` if the string matches the `strPattern`, which may contain one or more asterisk wildcard characters. Returns `0` if the string does not match. This method is case-sensitive.

### CkString.matchesNoCase

`Chilkat 11.7.0 · tcl · CkString · matchesNoCase · method`

```tcl
# strPattern is a string

set retBool [CkString_matchesNoCase $this $strPattern]
```

Returns `1` if the string matches the `strPattern`, which may contain one or more asterisk wildcard characters. Returns `0` if the string does not match. This method is case-insensitive.

### CkString.matchesNoCaseW

`Chilkat 11.7.0 · tcl · CkString · matchesNoCaseW · method`

```tcl
# s is a utf-16 string

set retBool [CkString_matchesNoCaseW $this $s]
```

The utf-16 version of matchesNoCase.

### CkString.matchesStr

`Chilkat 11.7.0 · tcl · CkString · matchesStr · method`

```tcl
# strPatternObj is a CkString

set retBool [CkString_matchesStr $this $strPatternObj]
```

Returns `1` if the string matches a pattern, otherwise returns `0`. The pattern may contain any number of wildcard '\*' characters which represent 0 or more occurrences of any character. This method is case-sensitive.

### CkString.matchesW

`Chilkat 11.7.0 · tcl · CkString · matchesW · method`

```tcl
# s is a utf-16 string

set retBool [CkString_matchesW $this $s]
```

The utf-16 version of the `matches` method.

### CkString.minimizeMemory

`Chilkat 11.7.0 · tcl · CkString · minimizeMemory · method`

```tcl
CkString_minimizeMemory $this
```

Minimizes the amount of memory consumed by this object. For example, consider the following: A CkString object is loaded with the contents of a text file. The `replaceAllOccurances` method is called, replacing longer substrings with shorter replacements. The actual string length will become shorter than the internal buffer space that is allocated. The minimizeMemory method will, if necessary, allocate a new internal buffer that is exactly the size needed to hold the current contents of the string, copy the string to the new internal buffer, and deallocate the old buffer.

### CkString.obfuscate

`Chilkat 11.7.0 · tcl · CkString · obfuscate · method`

```tcl
CkString_obfuscate $this
```

Obfuscates the string. (The unobfuscate method can be called to reverse the obfuscation to restore the original string.)

The Chilkat string obfuscation algorithm works by taking the utf-8 bytes of the string, base64 encoding it, and then scrambling the letters of the base64 encoded string. It is deterministic in that the same string will always obfuscate to the same result. It is not a secure way of encrypting a string. It is only meant to be a simple means of transforming a string into something unintelligible.

### CkString.prepend

`Chilkat 11.7.0 · tcl · CkString · prepend · method`

```tcl
# str is a string

CkString_prepend $this $str
```

Prepends `str` to this instance.

### CkString.prependW

`Chilkat 11.7.0 · tcl · CkString · prependW · method`

```tcl
# s is a utf-16 string

CkString_prependW $this $s
```

The utf-16 version of the `prepend` method.

### CkString.punyDecode

`Chilkat 11.7.0 · tcl · CkString · punyDecode · method · since 9.5.0.52`

```tcl
CkString_punyDecode $this
```

In-place decodes the string from punycode.

### CkString.punyEncode

`Chilkat 11.7.0 · tcl · CkString · punyEncode · method · since 9.5.0.52`

```tcl
CkString_punyEncode $this
```

In-place encodes the string to punycode.

### CkString.qpDecode

`Chilkat 11.7.0 · tcl · CkString · qpDecode · method`

```tcl
# charsetEncoding is a string

CkString_qpDecode $this $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)

Quoted-printable decodes the string and interprets the resulting character data according to the specified character encoding. The result is that the quoted-printable string is in-place decoded.

### CkString.qpDecodeW

`Chilkat 11.7.0 · tcl · CkString · qpDecodeW · method`

```tcl
# charset is a utf-16 string

CkString_qpDecodeW $this $charset
```

The utf-16 version of the qpDecode method.

### CkString.qpEncode

`Chilkat 11.7.0 · tcl · CkString · qpEncode · method`

```tcl
# charsetEncoding is a string

CkString_qpEncode $this $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)

Quoted-printable encodes the string. The string is first converted to the charset specified, and those bytes are QP-encoded. The contents of the string are replaced with the QP-encoded result.

### CkString.qpEncodeW

`Chilkat 11.7.0 · tcl · CkString · qpEncodeW · method`

```tcl
# charset is a utf-16 string

CkString_qpEncodeW $this $charset
```

The utf-16 version of the qpEncode method.

### CkString.removeAll

`Chilkat 11.7.0 · tcl · CkString · removeAll · method`

```tcl
# substr is a CkString

set retInt [CkString_removeAll $this $substr]
```

Removes all occurrences of `substr`.

### CkString.removeCharOccurances

`Chilkat 11.7.0 · tcl · CkString · removeCharOccurances · method`

```tcl
# ch is a char

CkString_removeCharOccurances $this $ch
```

Removes all occurrences of a specific ANSI character from the string.

### CkString.removeChunk

`Chilkat 11.7.0 · tcl · CkString · removeChunk · method`

```tcl
# charStartPos is an integer

# numChars is an integer

CkString_removeChunk $this $charStartPos  $numChars
```

Removes a chunk of characters specified by starting index and length.

### CkString.removeDelimited

`Chilkat 11.7.0 · tcl · CkString · removeDelimited · method · since 9.5.0.52`

```tcl
# beginDelim is a string

# endDelim is a string

# caseSensitive is a boolean

CkString_removeDelimited $this $beginDelim  $endDelim  $caseSensitive
```

Remove all occurrences of strings delimited by `beginDelim` and `endDelim`. Also removes the delimiters.

### CkString.removeFirst

`Chilkat 11.7.0 · tcl · CkString · removeFirst · method`

```tcl
# substr is a CkString

set retBool [CkString_removeFirst $this $substr]
```

Removes the first occurrence of a substring.

### CkString.replaceAll

`Chilkat 11.7.0 · tcl · CkString · replaceAll · method`

```tcl
# findStrObj is a CkString

# replaceStrObj is a CkString

set retInt [CkString_replaceAll $this $findStrObj  $replaceStrObj]
```

Replaces all occurrences of a substring with another. The replacement string is allowed to be empty or different in length.

### CkString.replaceAllOccurances

`Chilkat 11.7.0 · tcl · CkString · replaceAllOccurances · method`

```tcl
# findStr is a string

# replaceStr is a string

set retInt [CkString_replaceAllOccurances $this $findStr  $replaceStr]
```

Replaces all occurrences of a substring with another substring. The replacement string is allowed to be empty or different in length.

### CkString.replaceAllOccurancesW

`Chilkat 11.7.0 · tcl · CkString · replaceAllOccurancesW · method`

```tcl
# pattern is a utf-16 string

# replacement is a utf-16 string

set retInt [CkString_replaceAllOccurancesW $this $pattern  $replacement]
```

The utf-16 version of the replaceAllOccurances method.

### CkString.replaceChar

`Chilkat 11.7.0 · tcl · CkString · replaceChar · method`

```tcl
# findCh is a char

# replaceCh is a char

CkString_replaceChar $this $findCh  $replaceCh
```

Replaces all occurrences of a specified ANSI character with another.

### CkString.replaceFirst

`Chilkat 11.7.0 · tcl · CkString · replaceFirst · method`

```tcl
# findStrObj is a CkString

# replaceStrObj is a CkString

set retBool [CkString_replaceFirst $this $findStrObj  $replaceStrObj]
```

Replaces the first occurrence of a substring with another. The replacement string is allowed to be empty or different in length.

### CkString.replaceFirstOccurance

`Chilkat 11.7.0 · tcl · CkString · replaceFirstOccurance · method`

```tcl
# findStr is a string

# replaceStr is a string

set retBool [CkString_replaceFirstOccurance $this $findStr  $replaceStr]
```

Replaces the first occurrence of a substring with another. The replacement string is allowed to be empty or different in length. (Chilkat is aware of the misspelling of the word `occurrence`, but unfortunately it is too late to change..)

### CkString.replaceFirstOccuranceW

`Chilkat 11.7.0 · tcl · CkString · replaceFirstOccuranceW · method`

```tcl
# pattern is a utf-16 string

# replacement is a utf-16 string

set retBool [CkString_replaceFirstOccuranceW $this $pattern  $replacement]
```

The utf-16 version of replaceFirstOccurrance. (Chilkat is aware of the misspelling of the word `occurrence`, but unfortunately it is too late to change..)

### CkString.saveToFile

`Chilkat 11.7.0 · tcl · CkString · saveToFile · method`

```tcl
# path is a string

# charsetEncoding is a string

set status [CkString_saveToFile $this $path  $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)

Saves the string to a file using the character encoding specified by `charsetEncoding`. If a file of the same name exists, it is overwritten. For charsets such as `utf-8`, `utf-16`, or others that have a possible BOM/preamble, the preamble is output by default. To exclude the BOM/preamble, prepend `no-bom-` to the charset name. For example `no-bom-utf-8`.

Returns 1 for success, 0 for failure.

### CkString.saveToFileW

`Chilkat 11.7.0 · tcl · CkString · saveToFileW · method`

```tcl
# path is a utf-16 string

# charset is a utf-16 string

set status [CkString_saveToFileW $this $path  $charset]
```

The utf-16 version of the saveToFile method.

Returns 1 for success, 0 for failure.

### CkString.setStr

`Chilkat 11.7.0 · tcl · CkString · setStr · method`

```tcl
# s is a CkString

CkString_setStr $this $s
```

Replaces the contents of the string with another.

### CkString.setString

`Chilkat 11.7.0 · tcl · CkString · setString · method`

```tcl
# str is a string

CkString_setString $this $str
```

Clears the contents of this instance and appends `str`.

### CkString.setStringAnsi

`Chilkat 11.7.0 · tcl · CkString · setStringAnsi · method`

```tcl
# s is a string

CkString_setStringAnsi $this $s
```

Set the CkString object from an ANSI string.

### CkString.setStringU

`Chilkat 11.7.0 · tcl · CkString · setStringU · method`

```tcl
# unicode is a utf-16 string

CkString_setStringU $this $unicode
```

Set the CkString object from a Unicode string.

### CkString.setStringUtf8

`Chilkat 11.7.0 · tcl · CkString · setStringUtf8 · method`

```tcl
# s is a string

CkString_setStringUtf8 $this $s
```

Set the string object from a utf-8 string.

### CkString.shorten

`Chilkat 11.7.0 · tcl · CkString · shorten · method`

```tcl
# n is an integer

CkString_shorten $this $n
```

Discards the last N characters.

### CkString.split

`Chilkat 11.7.0 · tcl · CkString · split · method`

```tcl
# returns a CkStringArray

# delimiterChar is a char

# exceptDoubleQuoted is a boolean

# exceptEscaped is a boolean

# keepEmpty is a boolean

set ret_stringArray [CkString_split $this $delimiterChar  $exceptDoubleQuoted  $exceptEscaped  $keepEmpty]
```

Splits a string into a collection of strings using a delimiter character. If `exceptEscaped` is `1`, then delimiter chars escaped with a backslash are ignored. If `exceptDoubleQuoted` is `1`, then delimiter chars inside quotes are ignored. If `keepEmpty` is `0`, then empty strings are excluded from being added to the returned CkStringArray object.

Returns `NULL` on failure

### CkString.split2

`Chilkat 11.7.0 · tcl · CkString · split2 · method`

```tcl
# returns a CkStringArray

# delimiterChars is a string

# exceptDoubleQuoted is a boolean

# exceptEscaped is a boolean

# keepEmpty is a boolean

set ret_stringArray [CkString_split2 $this $delimiterChars  $exceptDoubleQuoted  $exceptEscaped  $keepEmpty]
```

Same as `split`, except a set of characters can be used for delimiters.

Returns `NULL` on failure

### CkString.split2W

`Chilkat 11.7.0 · tcl · CkString · split2W · method`

```tcl
# returns a CkStringArray

# splitCharSet is a utf-16 string

# exceptDoubleQuoted is a boolean

# exceptEscaped is a boolean

# keepEmpty is a boolean

set ret_stringArray [CkString_split2W $this $splitCharSet  $exceptDoubleQuoted  $exceptEscaped  $keepEmpty]
```

The utf-16 version of the split2 method.

Returns `NULL` on failure

### CkString.splitAtWS

`Chilkat 11.7.0 · tcl · CkString · splitAtWS · method`

```tcl
# returns a CkStringArray

set ret_stringArray [CkString_splitAtWS $this]
```

Equivalent to split2(`\t\r\n`,true,true,false)

Returns `NULL` on failure

### CkString.substring

`Chilkat 11.7.0 · tcl · CkString · substring · method`

```tcl
# returns a CkString

# startCharIndex is an integer

# numChars is an integer

set ret_ckString [CkString_substring $this $startCharIndex  $numChars]
```

Returns a substring specified by starting character position and number of characters. (The 1st char is at index 0.)

Returns `NULL` on failure

### CkString.toCRLF

`Chilkat 11.7.0 · tcl · CkString · toCRLF · method`

```tcl
CkString_toCRLF $this
```

Converts all line endings to CRLF.

### CkString.tokenize

`Chilkat 11.7.0 · tcl · CkString · tokenize · method`

```tcl
# returns a CkStringArray

# punctuation is a string

set ret_stringArray [CkString_tokenize $this $punctuation]
```

Tokenizes a string. The string is split at whitespace characters, and any single punctuation character is returned as a separate token. For example, this string:  
CkStringArray \*CkString::tokenize(char \*punctuation) const  

is tokenized to  

CkStringArray  
\*  
CkString  
:  
:  
tokenize  
(  
\*  
punctuation  
)  
const

Returns `NULL` on failure

### CkString.tokenizeW

`Chilkat 11.7.0 · tcl · CkString · tokenizeW · method`

```tcl
# returns a CkStringArray

# punctuation is a utf-16 string

set ret_stringArray [CkString_tokenizeW $this $punctuation]
```

The utf-16 version of the `tokenize` method.

Returns `NULL` on failure

### CkString.toLF

`Chilkat 11.7.0 · tcl · CkString · toLF · method`

```tcl
CkString_toLF $this
```

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

### CkString.toLowerCase

`Chilkat 11.7.0 · tcl · CkString · toLowerCase · method`

```tcl
CkString_toLowerCase $this
```

Converts the string to lowercase.

### CkString.toUpperCase

`Chilkat 11.7.0 · tcl · CkString · toUpperCase · method`

```tcl
CkString_toUpperCase $this
```

Converts the string to uppercase.

### CkString.trim

`Chilkat 11.7.0 · tcl · CkString · trim · method`

```tcl
CkString_trim $this
```

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

### CkString.trim2

`Chilkat 11.7.0 · tcl · CkString · trim2 · method`

```tcl
CkString_trim2 $this
```

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

### CkString.trimInsideSpaces

`Chilkat 11.7.0 · tcl · CkString · trimInsideSpaces · method`

```tcl
CkString_trimInsideSpaces $this
```

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

`Chilkat 11.7.0 · tcl · CkString · unobfuscate · method`

```tcl
CkString_unobfuscate $this
```

Unobfuscates the string.

The Chilkat string obfuscation algorithm works by taking the utf-8 bytes of the string, base64 encoding it, and then scrambling the letters of the base64 encoded string. It is deterministic in that the same string will always obfuscate to the same result. It is not a secure way of encrypting a string. It is only meant to be a simple means of transforming a string into something unintelligible.

### CkString.urlDecode

`Chilkat 11.7.0 · tcl · CkString · urlDecode · method`

```tcl
# charsetEncoding is a string

CkString_urlDecode $this $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)

URL decodes the string and interprets the resulting byte data in the specified charset encoding.

### CkString.urlDecodeW

`Chilkat 11.7.0 · tcl · CkString · urlDecodeW · method`

```tcl
# charsetEncoding is a utf-16 string

CkString_urlDecodeW $this $charsetEncoding
```

The utf-16 version of the urlDecode method.

### CkString.urlEncode

`Chilkat 11.7.0 · tcl · CkString · urlEncode · method`

```tcl
# charsetEncoding is a string

CkString_urlEncode $this $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)

URL encodes the string. The string is first converted to the specified charset encoding, and those bytes are URL-encoded. The contents of the string are replaced with the URL-encoded result.

### CkString.urlEncodeW

`Chilkat 11.7.0 · tcl · CkString · urlEncodeW · method`

```tcl
# charsetEncoding is a utf-16 string

CkString_urlEncodeW $this $charsetEncoding
```

The utf-16 version of the urlEncode method.

## Related classes

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

