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

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

## Purpose

The Chilkat string class.

## Object creation, unlocking and error handling

**Object Creation**

```python
obj = chilkat.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 CkPython.

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 | `# intVal is an integer intVal = ckString.get_NumArabic();` |
| `NumAscii` | property, read-only | `# intVal is an integer intVal = ckString.get_NumAscii();` |
| `NumCentralEuro` | property, read-only | `# intVal is an integer intVal = ckString.get_NumCentralEuro();` |
| `NumChinese` | property, read-only | `# intVal is an integer intVal = ckString.get_NumChinese();` |
| `NumCyrillic` | property, read-only | `# intVal is an integer intVal = ckString.get_NumCyrillic();` |
| `NumGreek` | property, read-only | `# intVal is an integer intVal = ckString.get_NumGreek();` |
| `NumHebrew` | property, read-only | `# intVal is an integer intVal = ckString.get_NumHebrew();` |
| `NumJapanese` | property, read-only | `# intVal is an integer intVal = ckString.get_NumJapanese();` |
| `NumKorean` | property, read-only | `# intVal is an integer intVal = ckString.get_NumKorean();` |
| `NumLatin` | property, read-only | `# intVal is an integer intVal = ckString.get_NumLatin();` |
| `NumThai` | property, read-only | `# intVal is an integer intVal = ckString.get_NumThai();` |
| `append` | method | `# str is a string ckString.append(str);` |
| `appendAnsi` | method | `# str is a string ckString.appendAnsi(str);` |
| `appendChar` | method | `# c is a char ckString.appendChar(c);` |
| `appendCurrentDateRfc822` | method | `ckString.appendCurrentDateRfc822();` |
| `appendEnc` | method | `# str is a string # charsetEncoding is a string ckString.appendEnc(str, charsetEncoding);` |
| `appendInt` | method | `# n is an integer ckString.appendInt(n);` |
| `appendN` | method | `# str is a string # numBytes is an integer ckString.appendN(str, numBytes);` |
| `appendNU` | method | `# wideStr is a utf-16 string # numChars is an integer ckString.appendNU(wideStr, numChars);` |
| `appendRandom` | method | `# numBytes is an integer # encoding is a string ckString.appendRandom(numBytes, encoding);` |
| `appendStr` | method | `# strObj is a CkString ckString.appendStr(strObj);` |
| `appendU` | method | `# unicode is a utf-16 string ckString.appendU(unicode);` |
| `appendUtf8` | method | `# str is a string ckString.appendUtf8(str);` |
| `base64Decode` | method | `# charsetEncoding is a string ckString.base64Decode(charsetEncoding);` |
| `base64DecodeW` | method | `# charsetEncoding is a utf-16 string ckString.base64DecodeW(charsetEncoding);` |
| `base64Encode` | method | `# charsetEncoding is a string ckString.base64Encode(charsetEncoding);` |
| `base64EncodeW` | method | `# charsetEncoding is a utf-16 string ckString.base64EncodeW(charsetEncoding);` |
| `beginsWith` | method | `# substr is a string retBool = ckString.beginsWith(substr);` |
| `beginsWithStr` | method | `# strObj is a CkString retBool = ckString.beginsWithStr(strObj);` |
| `beginsWithW` | method | `# str is a utf-16 string retBool = ckString.beginsWithW(str);` |
| `charAt` | method | `# idx is an integer retChar = ckString.charAt(idx);` |
| `charAtU` | method | `# idx is an integer utf16_char = ckString.charAtU(idx);` |
| `chopAtFirstChar` | method | `# ch is a char ckString.chopAtFirstChar(ch);` |
| `chopAtStr` | method | `# subStrObj is a CkString ckString.chopAtStr(subStrObj);` |
| `clear` | method | `ckString.clear();` |
| `clone` | method | `# returns a CkString ret_ckString = ckString.clone();` |
| `compareStr` | method | `# str is a CkString retInt = ckString.compareStr(str);` |
| `containsSubstring` | method | `# substr is a string retBool = ckString.containsSubstring(substr);` |
| `containsSubstringNoCase` | method | `# substr is a string retBool = ckString.containsSubstringNoCase(substr);` |
| `containsSubstringNoCaseW` | method | `# substr is a utf-16 string retBool = ckString.containsSubstringNoCaseW(substr);` |
| `containsSubstringW` | method | `# substr is a utf-16 string retBool = ckString.containsSubstringW(substr);` |
| `countCharOccurances` | method | `# ch is a char retInt = ckString.countCharOccurances(ch);` |
| `decodeXMLSpecial` | method | `ckString.decodeXMLSpecial();` |
| `doubleValue` | method | `retDouble = ckString.doubleValue();` |
| `eliminateChar` | method | `# ansiChar is a char # startIndex is an integer ckString.eliminateChar(ansiChar, startIndex);` |
| `encodeXMLSpecial` | method | `ckString.encodeXMLSpecial();` |
| `endsWith` | method | `# substr is a string retBool = ckString.endsWith(substr);` |
| `endsWithStr` | method | `# substrObj is a CkString retBool = ckString.endsWithStr(substrObj);` |
| `endsWithW` | method | `# s is a utf-16 string retBool = ckString.endsWithW(s);` |
| `entityDecode` | method | `ckString.entityDecode();` |
| `entityEncode` | method | `ckString.entityEncode();` |
| `equals` | method | `# str is a string retBool = ckString.equals(str);` |
| `equalsIgnoreCase` | method | `# str is a string retBool = ckString.equalsIgnoreCase(str);` |
| `equalsIgnoreCaseStr` | method | `# strObj is a CkString retBool = ckString.equalsIgnoreCaseStr(strObj);` |
| `equalsIgnoreCaseW` | method | `# s is a utf-16 string retBool = ckString.equalsIgnoreCaseW(s);` |
| `equalsStr` | method | `# strObj is a CkString retBool = ckString.equalsStr(strObj);` |
| `equalsW` | method | `# s is a utf-16 string retBool = ckString.equalsW(s);` |
| `getChar` | method | `# returns a CkString # idx is an integer ret_ckString = ckString.getChar(idx);` |
| `getNumChars` | method | `retInt = ckString.getNumChars();` |
| `getSizeAnsi` | method | `retInt = ckString.getSizeAnsi();` |
| `getSizeUnicode` | method | `retInt = ckString.getSizeUnicode();` |
| `getSizeUtf8` | method | `retInt = ckString.getSizeUtf8();` |
| `getUnicode` | method | `utf16_text = ckString.getUnicode();` |
| `hexDecode` | method | `# charsetEncoding is a string ckString.hexDecode(charsetEncoding);` |
| `hexDecodeW` | method | `# charsetEncoding is a utf-16 string ckString.hexDecodeW(charsetEncoding);` |
| `hexEncode` | method | `# charsetEncoding is a string ckString.hexEncode(charsetEncoding);` |
| `hexEncodeW` | method | `# charsetEncoding is a utf-16 string ckString.hexEncodeW(charsetEncoding);` |
| `indexOf` | method | `# substr is a string retInt = ckString.indexOf(substr);` |
| `indexOfStr` | method | `# substrObj is a CkString retInt = ckString.indexOfStr(substrObj);` |
| `indexOfW` | method | `# s is a utf-16 string retInt = ckString.indexOfW(s);` |
| `intValue` | method | `retInt = ckString.intValue();` |
| `isEmpty` | method | `retBool = ckString.isEmpty();` |
| `lastChar` | method | `retChar = ckString.lastChar();` |
| `loadFile` | method | `# path is a string # charsetEncoding is a string status = ckString.loadFile(path, charsetEncoding);` |
| `loadFileW` | method | `# path is a utf-16 string # charsetEncoding is a utf-16 string status = ckString.loadFileW(path, charsetEncoding);` |
| `matches` | method | `# strPattern is a string retBool = ckString.matches(strPattern);` |
| `matchesNoCase` | method | `# strPattern is a string retBool = ckString.matchesNoCase(strPattern);` |
| `matchesNoCaseW` | method | `# s is a utf-16 string retBool = ckString.matchesNoCaseW(s);` |
| `matchesStr` | method | `# strPatternObj is a CkString retBool = ckString.matchesStr(strPatternObj);` |
| `matchesW` | method | `# s is a utf-16 string retBool = ckString.matchesW(s);` |
| `minimizeMemory` | method | `ckString.minimizeMemory();` |
| `obfuscate` | method | `ckString.obfuscate();` |
| `prepend` | method | `# str is a string ckString.prepend(str);` |
| `prependW` | method | `# s is a utf-16 string ckString.prependW(s);` |
| `punyDecode` | method | `ckString.punyDecode();` |
| `punyEncode` | method | `ckString.punyEncode();` |
| `qpDecode` | method | `# charsetEncoding is a string ckString.qpDecode(charsetEncoding);` |
| `qpDecodeW` | method | `# charset is a utf-16 string ckString.qpDecodeW(charset);` |
| `qpEncode` | method | `# charsetEncoding is a string ckString.qpEncode(charsetEncoding);` |
| `qpEncodeW` | method | `# charset is a utf-16 string ckString.qpEncodeW(charset);` |
| `removeAll` | method | `# substr is a CkString retInt = ckString.removeAll(substr);` |
| `removeCharOccurances` | method | `# ch is a char ckString.removeCharOccurances(ch);` |
| `removeChunk` | method | `# charStartPos is an integer # numChars is an integer ckString.removeChunk(charStartPos, numChars);` |
| `removeDelimited` | method | `# beginDelim is a string # endDelim is a string # caseSensitive is a boolean ckString.removeDelimited(beginDelim, endDelim, caseSensitive);` |
| `removeFirst` | method | `# substr is a CkString retBool = ckString.removeFirst(substr);` |
| `replaceAll` | method | `# findStrObj is a CkString # replaceStrObj is a CkString retInt = ckString.replaceAll(findStrObj, replaceStrObj);` |
| `replaceAllOccurances` | method | `# findStr is a string # replaceStr is a string retInt = ckString.replaceAllOccurances(findStr, replaceStr);` |
| `replaceAllOccurancesW` | method | `# pattern is a utf-16 string # replacement is a utf-16 string retInt = ckString.replaceAllOccurancesW(pattern, replacement);` |
| `replaceChar` | method | `# findCh is a char # replaceCh is a char ckString.replaceChar(findCh, replaceCh);` |
| `replaceFirst` | method | `# findStrObj is a CkString # replaceStrObj is a CkString retBool = ckString.replaceFirst(findStrObj, replaceStrObj);` |
| `replaceFirstOccurance` | method | `# findStr is a string # replaceStr is a string retBool = ckString.replaceFirstOccurance(findStr, replaceStr);` |
| `replaceFirstOccuranceW` | method | `# pattern is a utf-16 string # replacement is a utf-16 string retBool = ckString.replaceFirstOccuranceW(pattern, replacement);` |
| `saveToFile` | method | `# path is a string # charsetEncoding is a string status = ckString.saveToFile(path, charsetEncoding);` |
| `saveToFileW` | method | `# path is a utf-16 string # charset is a utf-16 string status = ckString.saveToFileW(path, charset);` |
| `setStr` | method | `# s is a CkString ckString.setStr(s);` |
| `setString` | method | `# str is a string ckString.setString(str);` |
| `setStringAnsi` | method | `# s is a string ckString.setStringAnsi(s);` |
| `setStringU` | method | `# unicode is a utf-16 string ckString.setStringU(unicode);` |
| `setStringUtf8` | method | `# s is a string ckString.setStringUtf8(s);` |
| `shorten` | method | `# n is an integer ckString.shorten(n);` |
| `split` | method | `# returns a CkStringArray # delimiterChar is a char # exceptDoubleQuoted is a boolean # exceptEscaped is a boolean # keepEmpty is a boolean ret_stringArray = ckString.split(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 ret_stringArray = ckString.split2(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 ret_stringArray = ckString.split2W(splitCharSet, exceptDoubleQuoted, exceptEscaped, keepEmpty);` |
| `splitAtWS` | method | `# returns a CkStringArray ret_stringArray = ckString.splitAtWS();` |
| `substring` | method | `# returns a CkString # startCharIndex is an integer # numChars is an integer ret_ckString = ckString.substring(startCharIndex, numChars);` |
| `toCRLF` | method | `ckString.toCRLF();` |
| `tokenize` | method | `# returns a CkStringArray # punctuation is a string ret_stringArray = ckString.tokenize(punctuation);` |
| `tokenizeW` | method | `# returns a CkStringArray # punctuation is a utf-16 string ret_stringArray = ckString.tokenizeW(punctuation);` |
| `toLF` | method | `ckString.toLF();` |
| `toLowerCase` | method | `ckString.toLowerCase();` |
| `toUpperCase` | method | `ckString.toUpperCase();` |
| `trim` | method | `ckString.trim();` |
| `trim2` | method | `ckString.trim2();` |
| `trimInsideSpaces` | method | `ckString.trimInsideSpaces();` |
| `unobfuscate` | method | `ckString.unobfuscate();` |
| `urlDecode` | method | `# charsetEncoding is a string ckString.urlDecode(charsetEncoding);` |
| `urlDecodeW` | method | `# charsetEncoding is a utf-16 string ckString.urlDecodeW(charsetEncoding);` |
| `urlEncode` | method | `# charsetEncoding is a string ckString.urlEncode(charsetEncoding);` |
| `urlEncodeW` | method | `# charsetEncoding is a utf-16 string ckString.urlEncodeW(charsetEncoding);` |

## Properties

### CkString.NumArabic

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

```python
# intVal is an integer

intVal = ckString.get_NumArabic();
```

The number of Arabic characters contained in this string.

### CkString.NumAscii

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

```python
# intVal is an integer

intVal = ckString.get_NumAscii();
```

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

### CkString.NumCentralEuro

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

```python
# intVal is an integer

intVal = ckString.get_NumCentralEuro();
```

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

```python
# intVal is an integer

intVal = ckString.get_NumChinese();
```

The number of Chinese characters contained in this string.

### CkString.NumCyrillic

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

```python
# intVal is an integer

intVal = ckString.get_NumCyrillic();
```

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

```python
# intVal is an integer

intVal = ckString.get_NumGreek();
```

The number of Greek characters contained in this string.

### CkString.NumHebrew

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

```python
# intVal is an integer

intVal = ckString.get_NumHebrew();
```

The number of Hebrew characters contained in this string.

### CkString.NumJapanese

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

```python
# intVal is an integer

intVal = ckString.get_NumJapanese();
```

The number of Japanese characters contained in this string.

### CkString.NumKorean

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

```python
# intVal is an integer

intVal = ckString.get_NumKorean();
```

The number of Korean characters contained in this string.

### CkString.NumLatin

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

```python
# intVal is an integer

intVal = ckString.get_NumLatin();
```

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

```python
# intVal is an integer

intVal = ckString.get_NumThai();
```

The number of Thai characters contained in this string.

## Methods

### CkString.append

`Chilkat 11.7.0 · ckpython · CkString · append · method`

```python
# str is a string

ckString.append(str);
```

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

### CkString.appendAnsi

`Chilkat 11.7.0 · ckpython · CkString · appendAnsi · method`

```python
# str is a string

ckString.appendAnsi(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 · ckpython · CkString · appendChar · method`

```python
# c is a char

ckString.appendChar(c);
```

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

### CkString.appendCurrentDateRfc822

`Chilkat 11.7.0 · ckpython · CkString · appendCurrentDateRfc822 · method`

```python
ckString.appendCurrentDateRfc822();
```

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 · ckpython · CkString · appendEnc · method`

```python
# str is a string

# charsetEncoding is a string

ckString.appendEnc(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 · ckpython · CkString · appendInt · method`

```python
# n is an integer

ckString.appendInt(n);
```

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

### CkString.appendN

`Chilkat 11.7.0 · ckpython · CkString · appendN · method`

```python
# str is a string

# numBytes is an integer

ckString.appendN(str, numBytes);
```

Appends N bytes of character data to the end of this instance. If the Utf8 property is set to `True`, 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 · ckpython · CkString · appendNU · method`

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

# numChars is an integer

ckString.appendNU(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 · ckpython · CkString · appendRandom · method`

```python
# numBytes is an integer

# encoding is a string

ckString.appendRandom(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 · ckpython · CkString · appendStr · method`

```python
# strObj is a CkString

ckString.appendStr(strObj);
```

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

### CkString.appendU

`Chilkat 11.7.0 · ckpython · CkString · appendU · method`

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

ckString.appendU(unicode);
```

Append a Unicode string to the CkString object.

### CkString.appendUtf8

`Chilkat 11.7.0 · ckpython · CkString · appendUtf8 · method`

```python
# str is a string

ckString.appendUtf8(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 · ckpython · CkString · base64Decode · method`

```python
# charsetEncoding is a string

ckString.base64Decode(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 · ckpython · CkString · base64DecodeW · method`

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

ckString.base64DecodeW(charsetEncoding);
```

The utf-16 version of base64Decode.

### CkString.base64Encode

`Chilkat 11.7.0 · ckpython · CkString · base64Encode · method`

```python
# charsetEncoding is a string

ckString.base64Encode(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 · ckpython · CkString · base64EncodeW · method`

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

ckString.base64EncodeW(charsetEncoding);
```

The utf-16 version of base64Encode.

### CkString.beginsWith

`Chilkat 11.7.0 · ckpython · CkString · beginsWith · method`

```python
# substr is a string

retBool = ckString.beginsWith(substr);
```

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

### CkString.beginsWithStr

`Chilkat 11.7.0 · ckpython · CkString · beginsWithStr · method`

```python
# strObj is a CkString

retBool = ckString.beginsWithStr(strObj);
```

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

### CkString.beginsWithW

`Chilkat 11.7.0 · ckpython · CkString · beginsWithW · method`

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

retBool = ckString.beginsWithW(str);
```

The utf-16 version of beginsWith.

### CkString.charAt

`Chilkat 11.7.0 · ckpython · CkString · charAt · method`

```python
# idx is an integer

retChar = ckString.charAt(idx);
```

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

### CkString.charAtU

`Chilkat 11.7.0 · ckpython · CkString · charAtU · method`

```python
# idx is an integer

utf16_char = ckString.charAtU(idx);
```

Return the Nth character as a Unicode character.

### CkString.chopAtFirstChar

`Chilkat 11.7.0 · ckpython · CkString · chopAtFirstChar · method`

```python
# ch is a char

ckString.chopAtFirstChar(ch);
```

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

### CkString.chopAtStr

`Chilkat 11.7.0 · ckpython · CkString · chopAtStr · method`

```python
# subStrObj is a CkString

ckString.chopAtStr(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 · ckpython · CkString · clear · method`

```python
ckString.clear();
```

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

### CkString.clone

`Chilkat 11.7.0 · ckpython · CkString · clone · method`

```python
# returns a CkString

ret_ckString = ckString.clone();
```

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 `None` on failure

### CkString.compareStr

`Chilkat 11.7.0 · ckpython · CkString · compareStr · method`

```python
# str is a CkString

retInt = ckString.compareStr(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 · ckpython · CkString · containsSubstring · method`

```python
# substr is a string

retBool = ckString.containsSubstring(substr);
```

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

### CkString.containsSubstringNoCase

`Chilkat 11.7.0 · ckpython · CkString · containsSubstringNoCase · method`

```python
# substr is a string

retBool = ckString.containsSubstringNoCase(substr);
```

Same as containsSubstring except the matching is case insensitive.

### CkString.containsSubstringNoCaseW

`Chilkat 11.7.0 · ckpython · CkString · containsSubstringNoCaseW · method`

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

retBool = ckString.containsSubstringNoCaseW(substr);
```

The utf-16 version of containsSubstringNoCase.

### CkString.containsSubstringW

`Chilkat 11.7.0 · ckpython · CkString · containsSubstringW · method`

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

retBool = ckString.containsSubstringW(substr);
```

The utf-16 version of containsSubstring.

### CkString.countCharOccurances

`Chilkat 11.7.0 · ckpython · CkString · countCharOccurances · method`

```python
# ch is a char

retInt = ckString.countCharOccurances(ch);
```

Returns the number of occurrences of the specified ANSI char.

### CkString.decodeXMLSpecial

`Chilkat 11.7.0 · ckpython · CkString · decodeXMLSpecial · method`

```python
ckString.decodeXMLSpecial();
```

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

### CkString.doubleValue

`Chilkat 11.7.0 · ckpython · CkString · doubleValue · method`

```python
retDouble = ckString.doubleValue();
```

Converts the string to a double and returns the value.

### CkString.eliminateChar

`Chilkat 11.7.0 · ckpython · CkString · eliminateChar · method`

```python
# ansiChar is a char

# startIndex is an integer

ckString.eliminateChar(ansiChar, startIndex);
```

Eliminate all occurrences of a particular ANSI character.

### CkString.encodeXMLSpecial

`Chilkat 11.7.0 · ckpython · CkString · encodeXMLSpecial · method`

```python
ckString.encodeXMLSpecial();
```

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

### CkString.endsWith

`Chilkat 11.7.0 · ckpython · CkString · endsWith · method`

```python
# substr is a string

retBool = ckString.endsWith(substr);
```

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

### CkString.endsWithStr

`Chilkat 11.7.0 · ckpython · CkString · endsWithStr · method`

```python
# substrObj is a CkString

retBool = ckString.endsWithStr(substrObj);
```

Returns `True` if the string ends with the specified substring, otherwise returns `False`.

### CkString.endsWithW

`Chilkat 11.7.0 · ckpython · CkString · endsWithW · method`

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

retBool = ckString.endsWithW(s);
```

The utf-16 version of endsWith.

### CkString.entityDecode

`Chilkat 11.7.0 · ckpython · CkString · entityDecode · method`

```python
ckString.entityDecode();
```

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

### CkString.entityEncode

`Chilkat 11.7.0 · ckpython · CkString · entityEncode · method`

```python
ckString.entityEncode();
```

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

### CkString.equals

`Chilkat 11.7.0 · ckpython · CkString · equals · method`

```python
# str is a string

retBool = ckString.equals(str);
```

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

### CkString.equalsIgnoreCase

`Chilkat 11.7.0 · ckpython · CkString · equalsIgnoreCase · method`

```python
# str is a string

retBool = ckString.equalsIgnoreCase(str);
```

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

### CkString.equalsIgnoreCaseStr

`Chilkat 11.7.0 · ckpython · CkString · equalsIgnoreCaseStr · method`

```python
# strObj is a CkString

retBool = ckString.equalsIgnoreCaseStr(strObj);
```

Returns `True` if the strings are equal, otherwise returns `False` (case-insensitive)

### CkString.equalsIgnoreCaseW

`Chilkat 11.7.0 · ckpython · CkString · equalsIgnoreCaseW · method`

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

retBool = ckString.equalsIgnoreCaseW(s);
```

The utf-16 version of equalsIgnoreCase.

### CkString.equalsStr

`Chilkat 11.7.0 · ckpython · CkString · equalsStr · method`

```python
# strObj is a CkString

retBool = ckString.equalsStr(strObj);
```

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

### CkString.equalsW

`Chilkat 11.7.0 · ckpython · CkString · equalsW · method`

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

retBool = ckString.equalsW(s);
```

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

### CkString.getChar

`Chilkat 11.7.0 · ckpython · CkString · getChar · method`

```python
# returns a CkString

# idx is an integer

ret_ckString = ckString.getChar(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 `None` on failure

### CkString.getNumChars

`Chilkat 11.7.0 · ckpython · CkString · getNumChars · method`

```python
retInt = ckString.getNumChars();
```

Returns the number of characters in the string.

### CkString.getSizeAnsi

`Chilkat 11.7.0 · ckpython · CkString · getSizeAnsi · method`

```python
retInt = ckString.getSizeAnsi();
```

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

### CkString.getSizeUnicode

`Chilkat 11.7.0 · ckpython · CkString · getSizeUnicode · method`

```python
retInt = ckString.getSizeUnicode();
```

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

### CkString.getSizeUtf8

`Chilkat 11.7.0 · ckpython · CkString · getSizeUtf8 · method`

```python
retInt = ckString.getSizeUtf8();
```

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

### CkString.getUnicode

`Chilkat 11.7.0 · ckpython · CkString · getUnicode · method`

```python
utf16_text = ckString.getUnicode();
```

Return a pointer to memory containing the string in Unicode.

### CkString.hexDecode

`Chilkat 11.7.0 · ckpython · CkString · hexDecode · method`

```python
# charsetEncoding is a string

ckString.hexDecode(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 · ckpython · CkString · hexDecodeW · method`

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

ckString.hexDecodeW(charsetEncoding);
```

The utf-16 version of hexDecode.

### CkString.hexEncode

`Chilkat 11.7.0 · ckpython · CkString · hexEncode · method`

```python
# charsetEncoding is a string

ckString.hexEncode(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 · ckpython · CkString · hexEncodeW · method`

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

ckString.hexEncodeW(charsetEncoding);
```

The utf-16 version of hexEncode.

### CkString.indexOf

`Chilkat 11.7.0 · ckpython · CkString · indexOf · method`

```python
# substr is a string

retInt = ckString.indexOf(substr);
```

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

### CkString.indexOfStr

`Chilkat 11.7.0 · ckpython · CkString · indexOfStr · method`

```python
# substrObj is a CkString

retInt = ckString.indexOfStr(substrObj);
```

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

### CkString.indexOfW

`Chilkat 11.7.0 · ckpython · CkString · indexOfW · method`

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

retInt = ckString.indexOfW(s);
```

The utf-16 version of `indexOf`.

### CkString.intValue

`Chilkat 11.7.0 · ckpython · CkString · intValue · method`

```python
retInt = ckString.intValue();
```

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

### CkString.isEmpty

`Chilkat 11.7.0 · ckpython · CkString · isEmpty · method`

```python
retBool = ckString.isEmpty();
```

Returns `True` if the string object is empty, otherwise returns `False`.

### CkString.lastChar

`Chilkat 11.7.0 · ckpython · CkString · lastChar · method`

```python
retChar = ckString.lastChar();
```

Returns the last ANSI character in the string.

### CkString.loadFile

`Chilkat 11.7.0 · ckpython · CkString · loadFile · method`

```python
# path is a string

# charsetEncoding is a string

status = ckString.loadFile(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 True for success, False for failure.

### CkString.loadFileW

`Chilkat 11.7.0 · ckpython · CkString · loadFileW · method`

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

# charsetEncoding is a utf-16 string

status = ckString.loadFileW(path, charsetEncoding);
```

The utf-16 version of loadFile.

Returns True for success, False for failure.

### CkString.matches

`Chilkat 11.7.0 · ckpython · CkString · matches · method`

```python
# strPattern is a string

retBool = ckString.matches(strPattern);
```

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

### CkString.matchesNoCase

`Chilkat 11.7.0 · ckpython · CkString · matchesNoCase · method`

```python
# strPattern is a string

retBool = ckString.matchesNoCase(strPattern);
```

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

### CkString.matchesNoCaseW

`Chilkat 11.7.0 · ckpython · CkString · matchesNoCaseW · method`

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

retBool = ckString.matchesNoCaseW(s);
```

The utf-16 version of matchesNoCase.

### CkString.matchesStr

`Chilkat 11.7.0 · ckpython · CkString · matchesStr · method`

```python
# strPatternObj is a CkString

retBool = ckString.matchesStr(strPatternObj);
```

Returns `True` if the string matches a pattern, otherwise returns `False`. 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 · ckpython · CkString · matchesW · method`

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

retBool = ckString.matchesW(s);
```

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

### CkString.minimizeMemory

`Chilkat 11.7.0 · ckpython · CkString · minimizeMemory · method`

```python
ckString.minimizeMemory();
```

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 · ckpython · CkString · obfuscate · method`

```python
ckString.obfuscate();
```

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 · ckpython · CkString · prepend · method`

```python
# str is a string

ckString.prepend(str);
```

Prepends `str` to this instance.

### CkString.prependW

`Chilkat 11.7.0 · ckpython · CkString · prependW · method`

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

ckString.prependW(s);
```

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

### CkString.punyDecode

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

```python
ckString.punyDecode();
```

In-place decodes the string from punycode.

### CkString.punyEncode

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

```python
ckString.punyEncode();
```

In-place encodes the string to punycode.

### CkString.qpDecode

`Chilkat 11.7.0 · ckpython · CkString · qpDecode · method`

```python
# charsetEncoding is a string

ckString.qpDecode(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 · ckpython · CkString · qpDecodeW · method`

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

ckString.qpDecodeW(charset);
```

The utf-16 version of the qpDecode method.

### CkString.qpEncode

`Chilkat 11.7.0 · ckpython · CkString · qpEncode · method`

```python
# charsetEncoding is a string

ckString.qpEncode(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 · ckpython · CkString · qpEncodeW · method`

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

ckString.qpEncodeW(charset);
```

The utf-16 version of the qpEncode method.

### CkString.removeAll

`Chilkat 11.7.0 · ckpython · CkString · removeAll · method`

```python
# substr is a CkString

retInt = ckString.removeAll(substr);
```

Removes all occurrences of `substr`.

### CkString.removeCharOccurances

`Chilkat 11.7.0 · ckpython · CkString · removeCharOccurances · method`

```python
# ch is a char

ckString.removeCharOccurances(ch);
```

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

### CkString.removeChunk

`Chilkat 11.7.0 · ckpython · CkString · removeChunk · method`

```python
# charStartPos is an integer

# numChars is an integer

ckString.removeChunk(charStartPos, numChars);
```

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

### CkString.removeDelimited

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

```python
# beginDelim is a string

# endDelim is a string

# caseSensitive is a boolean

ckString.removeDelimited(beginDelim, endDelim, caseSensitive);
```

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

### CkString.removeFirst

`Chilkat 11.7.0 · ckpython · CkString · removeFirst · method`

```python
# substr is a CkString

retBool = ckString.removeFirst(substr);
```

Removes the first occurrence of a substring.

### CkString.replaceAll

`Chilkat 11.7.0 · ckpython · CkString · replaceAll · method`

```python
# findStrObj is a CkString

# replaceStrObj is a CkString

retInt = ckString.replaceAll(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 · ckpython · CkString · replaceAllOccurances · method`

```python
# findStr is a string

# replaceStr is a string

retInt = ckString.replaceAllOccurances(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 · ckpython · CkString · replaceAllOccurancesW · method`

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

# replacement is a utf-16 string

retInt = ckString.replaceAllOccurancesW(pattern, replacement);
```

The utf-16 version of the replaceAllOccurances method.

### CkString.replaceChar

`Chilkat 11.7.0 · ckpython · CkString · replaceChar · method`

```python
# findCh is a char

# replaceCh is a char

ckString.replaceChar(findCh, replaceCh);
```

Replaces all occurrences of a specified ANSI character with another.

### CkString.replaceFirst

`Chilkat 11.7.0 · ckpython · CkString · replaceFirst · method`

```python
# findStrObj is a CkString

# replaceStrObj is a CkString

retBool = ckString.replaceFirst(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 · ckpython · CkString · replaceFirstOccurance · method`

```python
# findStr is a string

# replaceStr is a string

retBool = ckString.replaceFirstOccurance(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 · ckpython · CkString · replaceFirstOccuranceW · method`

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

# replacement is a utf-16 string

retBool = ckString.replaceFirstOccuranceW(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 · ckpython · CkString · saveToFile · method`

```python
# path is a string

# charsetEncoding is a string

status = ckString.saveToFile(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 True for success, False for failure.

### CkString.saveToFileW

`Chilkat 11.7.0 · ckpython · CkString · saveToFileW · method`

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

# charset is a utf-16 string

status = ckString.saveToFileW(path, charset);
```

The utf-16 version of the saveToFile method.

Returns True for success, False for failure.

### CkString.setStr

`Chilkat 11.7.0 · ckpython · CkString · setStr · method`

```python
# s is a CkString

ckString.setStr(s);
```

Replaces the contents of the string with another.

### CkString.setString

`Chilkat 11.7.0 · ckpython · CkString · setString · method`

```python
# str is a string

ckString.setString(str);
```

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

### CkString.setStringAnsi

`Chilkat 11.7.0 · ckpython · CkString · setStringAnsi · method`

```python
# s is a string

ckString.setStringAnsi(s);
```

Set the CkString object from an ANSI string.

### CkString.setStringU

`Chilkat 11.7.0 · ckpython · CkString · setStringU · method`

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

ckString.setStringU(unicode);
```

Set the CkString object from a Unicode string.

### CkString.setStringUtf8

`Chilkat 11.7.0 · ckpython · CkString · setStringUtf8 · method`

```python
# s is a string

ckString.setStringUtf8(s);
```

Set the string object from a utf-8 string.

### CkString.shorten

`Chilkat 11.7.0 · ckpython · CkString · shorten · method`

```python
# n is an integer

ckString.shorten(n);
```

Discards the last N characters.

### CkString.split

`Chilkat 11.7.0 · ckpython · CkString · split · method`

```python
# returns a CkStringArray

# delimiterChar is a char

# exceptDoubleQuoted is a boolean

# exceptEscaped is a boolean

# keepEmpty is a boolean

ret_stringArray = ckString.split(delimiterChar, exceptDoubleQuoted, exceptEscaped, keepEmpty);
```

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

Returns `None` on failure

### CkString.split2

`Chilkat 11.7.0 · ckpython · CkString · split2 · method`

```python
# returns a CkStringArray

# delimiterChars is a string

# exceptDoubleQuoted is a boolean

# exceptEscaped is a boolean

# keepEmpty is a boolean

ret_stringArray = ckString.split2(delimiterChars, exceptDoubleQuoted, exceptEscaped, keepEmpty);
```

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

Returns `None` on failure

### CkString.split2W

`Chilkat 11.7.0 · ckpython · CkString · split2W · method`

```python
# returns a CkStringArray

# splitCharSet is a utf-16 string

# exceptDoubleQuoted is a boolean

# exceptEscaped is a boolean

# keepEmpty is a boolean

ret_stringArray = ckString.split2W(splitCharSet, exceptDoubleQuoted, exceptEscaped, keepEmpty);
```

The utf-16 version of the split2 method.

Returns `None` on failure

### CkString.splitAtWS

`Chilkat 11.7.0 · ckpython · CkString · splitAtWS · method`

```python
# returns a CkStringArray

ret_stringArray = ckString.splitAtWS();
```

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

Returns `None` on failure

### CkString.substring

`Chilkat 11.7.0 · ckpython · CkString · substring · method`

```python
# returns a CkString

# startCharIndex is an integer

# numChars is an integer

ret_ckString = ckString.substring(startCharIndex, numChars);
```

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

Returns `None` on failure

### CkString.toCRLF

`Chilkat 11.7.0 · ckpython · CkString · toCRLF · method`

```python
ckString.toCRLF();
```

Converts all line endings to CRLF.

### CkString.tokenize

`Chilkat 11.7.0 · ckpython · CkString · tokenize · method`

```python
# returns a CkStringArray

# punctuation is a string

ret_stringArray = ckString.tokenize(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 `None` on failure

### CkString.tokenizeW

`Chilkat 11.7.0 · ckpython · CkString · tokenizeW · method`

```python
# returns a CkStringArray

# punctuation is a utf-16 string

ret_stringArray = ckString.tokenizeW(punctuation);
```

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

Returns `None` on failure

### CkString.toLF

`Chilkat 11.7.0 · ckpython · CkString · toLF · method`

```python
ckString.toLF();
```

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

### CkString.toLowerCase

`Chilkat 11.7.0 · ckpython · CkString · toLowerCase · method`

```python
ckString.toLowerCase();
```

Converts the string to lowercase.

### CkString.toUpperCase

`Chilkat 11.7.0 · ckpython · CkString · toUpperCase · method`

```python
ckString.toUpperCase();
```

Converts the string to uppercase.

### CkString.trim

`Chilkat 11.7.0 · ckpython · CkString · trim · method`

```python
ckString.trim();
```

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

### CkString.trim2

`Chilkat 11.7.0 · ckpython · CkString · trim2 · method`

```python
ckString.trim2();
```

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

### CkString.trimInsideSpaces

`Chilkat 11.7.0 · ckpython · CkString · trimInsideSpaces · method`

```python
ckString.trimInsideSpaces();
```

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 · ckpython · CkString · unobfuscate · method`

```python
ckString.unobfuscate();
```

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 · ckpython · CkString · urlDecode · method`

```python
# charsetEncoding is a string

ckString.urlDecode(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 · ckpython · CkString · urlDecodeW · method`

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

ckString.urlDecodeW(charsetEncoding);
```

The utf-16 version of the urlDecode method.

### CkString.urlEncode

`Chilkat 11.7.0 · ckpython · CkString · urlEncode · method`

```python
# charsetEncoding is a string

ckString.urlEncode(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 · ckpython · CkString · urlEncodeW · method`

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

ckString.urlEncodeW(charsetEncoding);
```

The utf-16 version of the urlEncode method.

## Related classes

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

