---
product: Chilkat
product_version: 11.7.0
language: cpp
language_label: C++
class: CkString
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/vcCkStringRef.html
---
# Chilkat CkString — C++ — v11.7.0

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

## Purpose

The Chilkat string class.

## Object creation, unlocking and error handling

**Object Creation**

```cpp
// Local variable on the stack
CkString obj;

// Dynamically allocate/delete
CkString *pObj = new CkString();
// ...
delete pObj;
```

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

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

## Properties

### CkString.NumArabic

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

```cpp
int get_NumArabic(void);
```

The number of Arabic characters contained in this string.

### CkString.NumAscii

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

```cpp
int get_NumAscii(void);
```

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

### CkString.NumCentralEuro

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

```cpp
int get_NumCentralEuro(void);
```

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

```cpp
int get_NumChinese(void);
```

The number of Chinese characters contained in this string.

### CkString.NumCyrillic

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

```cpp
int get_NumCyrillic(void);
```

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

```cpp
int get_NumGreek(void);
```

The number of Greek characters contained in this string.

### CkString.NumHebrew

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

```cpp
int get_NumHebrew(void);
```

The number of Hebrew characters contained in this string.

### CkString.NumJapanese

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

```cpp
int get_NumJapanese(void);
```

The number of Japanese characters contained in this string.

### CkString.NumKorean

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

```cpp
int get_NumKorean(void);
```

The number of Korean characters contained in this string.

### CkString.NumLatin

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

```cpp
int get_NumLatin(void);
```

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

```cpp
int get_NumThai(void);
```

The number of Thai characters contained in this string.

## Methods

### CkString.append

`Chilkat 11.7.0 · cpp · CkString · append · method`

```cpp
void append(const char *str);
```

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

### CkString.appendAnsi

`Chilkat 11.7.0 · cpp · CkString · appendAnsi · method`

```cpp
void appendAnsi(const char *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 · cpp · CkString · appendChar · method`

```cpp
void appendChar(char c);
```

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

### CkString.appendCurrentDateRfc822

`Chilkat 11.7.0 · cpp · CkString · appendCurrentDateRfc822 · method`

```cpp
void appendCurrentDateRfc822(void);
```

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

```cpp
void appendEnc(const char *str, const char *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.appendHexData

`Chilkat 11.7.0 · cpp · CkString · appendHexData · method`

```cpp
void appendHexData(const void *byteData, unsigned long numBytes);
```

Converts the binary data to a hexidecimal string representation and appends to the end of this instance. The hex data is appended in 2-byte chunks with 16 bytes per line. For example:

```
6861 6C6C 6861 6C6C 6861 6C6C 6861 6C6C
6861 6C6C 6861 6C6C 6861 6C6C 6861 6C6C
6861 6C6C 6861 6C6C 6861 6C6C 6861 6C6C
```

### CkString.appendInt

`Chilkat 11.7.0 · cpp · CkString · appendInt · method`

```cpp
void appendInt(int n);
```

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

### CkString.appendN

`Chilkat 11.7.0 · cpp · CkString · appendN · method`

```cpp
void appendN(const char *str, unsigned long 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 · cpp · CkString · appendNU · method`

```cpp
void appendNU(const wchar_t *wideStr, int 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 · cpp · CkString · appendRandom · method`

```cpp
void appendRandom(int numBytes, const char *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 · cpp · CkString · appendStr · method`

```cpp
void appendStr(CkString &strObj);
```

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

### CkString.appendU

`Chilkat 11.7.0 · cpp · CkString · appendU · method`

```cpp
void appendU(const wchar_t *unicode);
```

Append a Unicode string to the CkString object.

### CkString.appendUtf8

`Chilkat 11.7.0 · cpp · CkString · appendUtf8 · method`

```cpp
void appendUtf8(const char *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 · cpp · CkString · base64Decode · method`

```cpp
void base64Decode(const char *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 · cpp · CkString · base64DecodeW · method`

```cpp
void base64DecodeW(const wchar_t *charsetEncoding);
```

The utf-16 version of base64Decode.

### CkString.base64Encode

`Chilkat 11.7.0 · cpp · CkString · base64Encode · method`

```cpp
void base64Encode(const char *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 · cpp · CkString · base64EncodeW · method`

```cpp
void base64EncodeW(const wchar_t *charsetEncoding);
```

The utf-16 version of base64Encode.

### CkString.beginsWith

`Chilkat 11.7.0 · cpp · CkString · beginsWith · method`

```cpp
bool beginsWith(const char *substr);
```

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

### CkString.beginsWithStr

`Chilkat 11.7.0 · cpp · CkString · beginsWithStr · method`

```cpp
bool beginsWithStr(CkString &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 · cpp · CkString · beginsWithW · method`

```cpp
bool beginsWithW(const wchar_t *str);
```

The utf-16 version of beginsWith.

### CkString.charAt

`Chilkat 11.7.0 · cpp · CkString · charAt · method`

```cpp
char charAt(int idx);
```

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

### CkString.charAtU

`Chilkat 11.7.0 · cpp · CkString · charAtU · method`

```cpp
wchar_t charAtU(int idx);
```

Return the Nth character as a Unicode character.

### CkString.chopAtFirstChar

`Chilkat 11.7.0 · cpp · CkString · chopAtFirstChar · method`

```cpp
void chopAtFirstChar(char ch);
```

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

### CkString.chopAtStr

`Chilkat 11.7.0 · cpp · CkString · chopAtStr · method`

```cpp
void chopAtStr(CkString &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 · cpp · CkString · clear · method`

```cpp
void clear(void);
```

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

### CkString.clone

`Chilkat 11.7.0 · cpp · CkString · clone · method`

```cpp
CkString *clone(void);
```

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.

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.compareStr

`Chilkat 11.7.0 · cpp · CkString · compareStr · method`

```cpp
int compareStr(CkString &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 · cpp · CkString · containsSubstring · method`

```cpp
bool containsSubstring(const char *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 · cpp · CkString · containsSubstringNoCase · method`

```cpp
bool containsSubstringNoCase(const char *substr);
```

Same as containsSubstring except the matching is case insensitive.

### CkString.containsSubstringNoCaseW

`Chilkat 11.7.0 · cpp · CkString · containsSubstringNoCaseW · method`

```cpp
bool containsSubstringNoCaseW(const wchar_t *substr);
```

The utf-16 version of containsSubstringNoCase.

### CkString.containsSubstringW

`Chilkat 11.7.0 · cpp · CkString · containsSubstringW · method`

```cpp
bool containsSubstringW(const wchar_t *substr);
```

The utf-16 version of containsSubstring.

### CkString.countCharOccurances

`Chilkat 11.7.0 · cpp · CkString · countCharOccurances · method`

```cpp
int countCharOccurances(char ch);
```

Returns the number of occurrences of the specified ANSI char.

### CkString.decodeXMLSpecial

`Chilkat 11.7.0 · cpp · CkString · decodeXMLSpecial · method`

```cpp
void decodeXMLSpecial(void);
```

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

### CkString.doubleValue

`Chilkat 11.7.0 · cpp · CkString · doubleValue · method`

```cpp
double doubleValue(void);
```

Converts the string to a double and returns the value.

### CkString.eliminateChar

`Chilkat 11.7.0 · cpp · CkString · eliminateChar · method`

```cpp
void eliminateChar(char ansiChar, int startIndex);
```

Eliminate all occurrences of a particular ANSI character.

### CkString.encodeXMLSpecial

`Chilkat 11.7.0 · cpp · CkString · encodeXMLSpecial · method`

```cpp
void encodeXMLSpecial(void);
```

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

### CkString.endsWith

`Chilkat 11.7.0 · cpp · CkString · endsWith · method`

```cpp
bool endsWith(const char *substr);
```

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

### CkString.endsWithStr

`Chilkat 11.7.0 · cpp · CkString · endsWithStr · method`

```cpp
bool endsWithStr(CkString &substrObj);
```

Returns `true` if the string ends with the specified substring, otherwise returns `false`.

### CkString.endsWithW

`Chilkat 11.7.0 · cpp · CkString · endsWithW · method`

```cpp
bool endsWithW(const wchar_t *s);
```

The utf-16 version of endsWith.

### CkString.entityDecode

`Chilkat 11.7.0 · cpp · CkString · entityDecode · method`

```cpp
void entityDecode(void);
```

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

### CkString.entityEncode

`Chilkat 11.7.0 · cpp · CkString · entityEncode · method`

```cpp
void entityEncode(void);
```

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

### CkString.equals

`Chilkat 11.7.0 · cpp · CkString · equals · method`

```cpp
bool equals(const char *str);
```

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

### CkString.equalsIgnoreCase

`Chilkat 11.7.0 · cpp · CkString · equalsIgnoreCase · method`

```cpp
bool equalsIgnoreCase(const char *str);
```

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

### CkString.equalsIgnoreCaseStr

`Chilkat 11.7.0 · cpp · CkString · equalsIgnoreCaseStr · method`

```cpp
bool equalsIgnoreCaseStr(CkString &strObj);
```

Returns `true` if the strings are equal, otherwise returns `false` (case-insensitive)

### CkString.equalsIgnoreCaseW

`Chilkat 11.7.0 · cpp · CkString · equalsIgnoreCaseW · method`

```cpp
bool equalsIgnoreCaseW(const wchar_t *s);
```

The utf-16 version of equalsIgnoreCase.

### CkString.equalsStr

`Chilkat 11.7.0 · cpp · CkString · equalsStr · method`

```cpp
bool equalsStr(CkString &strObj);
```

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

### CkString.equalsW

`Chilkat 11.7.0 · cpp · CkString · equalsW · method`

```cpp
bool equalsW(const wchar_t *s);
```

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

### CkString.getChar

`Chilkat 11.7.0 · cpp · CkString · getChar · method`

```cpp
CkString *getChar(int 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.

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.getEnc

`Chilkat 11.7.0 · cpp · CkString · getEnc · method`

```cpp
const char *getEnc(const char *encoding);
```

Returns the string as a null-terminated byte sequence in the character encoding specified by `encoding`. The `encoding` can be any encoding specified at the link below, except for charsets that contain 0 (null) bytes in individual character byte representations, such as utf-16, utf-32, etc.

See also:

- [Character Encodings (Charsets) Supported by Chilkat](http://cknotes.com/chilkat-charsets-character-encodings-supported/)

### CkString.getNumChars

`Chilkat 11.7.0 · cpp · CkString · getNumChars · method`

```cpp
int getNumChars(void);
```

Returns the number of characters in the string.

### CkString.getSizeAnsi

`Chilkat 11.7.0 · cpp · CkString · getSizeAnsi · method`

```cpp
int getSizeAnsi(void);
```

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

### CkString.getSizeUnicode

`Chilkat 11.7.0 · cpp · CkString · getSizeUnicode · method`

```cpp
int getSizeUnicode(void);
```

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

### CkString.getSizeUtf8

`Chilkat 11.7.0 · cpp · CkString · getSizeUtf8 · method`

```cpp
int getSizeUtf8(void);
```

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

### CkString.getString

`Chilkat 11.7.0 · cpp · CkString · getString · method`

```cpp
const char *getString(void);
```

Returns the contents of this instance.

### CkString.getStringAnsi

`Chilkat 11.7.0 · cpp · CkString · getStringAnsi · method`

```cpp
const char *getStringAnsi(void);
```

Returns the string as null-terminated ANSI.

### CkString.getStringUtf8

`Chilkat 11.7.0 · cpp · CkString · getStringUtf8 · method`

```cpp
const char *getStringUtf8(void);
```

Returns the string as null-terminated utf-8.

### CkString.getUnicode

`Chilkat 11.7.0 · cpp · CkString · getUnicode · method`

```cpp
const wchar_t *getUnicode(void);
```

Return a pointer to memory containing the string in Unicode.

### CkString.hexDecode

`Chilkat 11.7.0 · cpp · CkString · hexDecode · method`

```cpp
void hexDecode(const char *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 · cpp · CkString · hexDecodeW · method`

```cpp
void hexDecodeW(const wchar_t *charsetEncoding);
```

The utf-16 version of hexDecode.

### CkString.hexEncode

`Chilkat 11.7.0 · cpp · CkString · hexEncode · method`

```cpp
void hexEncode(const char *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 · cpp · CkString · hexEncodeW · method`

```cpp
void hexEncodeW(const wchar_t *charsetEncoding);
```

The utf-16 version of hexEncode.

### CkString.indexOf

`Chilkat 11.7.0 · cpp · CkString · indexOf · method`

```cpp
int indexOf(const char *substr);
```

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

### CkString.indexOfStr

`Chilkat 11.7.0 · cpp · CkString · indexOfStr · method`

```cpp
int indexOfStr(CkString &substrObj);
```

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

### CkString.indexOfW

`Chilkat 11.7.0 · cpp · CkString · indexOfW · method`

```cpp
int indexOfW(const wchar_t *s);
```

The utf-16 version of `indexOf`.

### CkString.intValue

`Chilkat 11.7.0 · cpp · CkString · intValue · method`

```cpp
int intValue(void);
```

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

### CkString.isEmpty

`Chilkat 11.7.0 · cpp · CkString · isEmpty · method`

```cpp
bool isEmpty(void);
```

Returns `true` if the string object is empty, otherwise returns `false`.

### CkString.lastChar

`Chilkat 11.7.0 · cpp · CkString · lastChar · method`

```cpp
char lastChar(void);
```

Returns the last ANSI character in the string.

### CkString.loadFile

`Chilkat 11.7.0 · cpp · CkString · loadFile · method`

```cpp
bool loadFile(const char *path, const char *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 · cpp · CkString · loadFileW · method`

```cpp
bool loadFileW(const wchar_t *path, const wchar_t *charsetEncoding);
```

The utf-16 version of loadFile.

Returns true for success, false for failure.

### CkString.matches

`Chilkat 11.7.0 · cpp · CkString · matches · method`

```cpp
bool matches(const char *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 · cpp · CkString · matchesNoCase · method`

```cpp
bool matchesNoCase(const char *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 · cpp · CkString · matchesNoCaseW · method`

```cpp
bool matchesNoCaseW(const wchar_t *s);
```

The utf-16 version of matchesNoCase.

### CkString.matchesStr

`Chilkat 11.7.0 · cpp · CkString · matchesStr · method`

```cpp
bool matchesStr(CkString &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 · cpp · CkString · matchesW · method`

```cpp
bool matchesW(const wchar_t *s);
```

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

### CkString.minimizeMemory

`Chilkat 11.7.0 · cpp · CkString · minimizeMemory · method`

```cpp
void minimizeMemory(void);
```

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

```cpp
void obfuscate(void);
```

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

```cpp
void prepend(const char *str);
```

Prepends `str` to this instance.

### CkString.prependW

`Chilkat 11.7.0 · cpp · CkString · prependW · method`

```cpp
void prependW(const wchar_t *s);
```

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

### CkString.punyDecode

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

```cpp
void punyDecode(void);
```

In-place decodes the string from punycode.

### CkString.punyEncode

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

```cpp
void punyEncode(void);
```

In-place encodes the string to punycode.

### CkString.qpDecode

`Chilkat 11.7.0 · cpp · CkString · qpDecode · method`

```cpp
void qpDecode(const char *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 · cpp · CkString · qpDecodeW · method`

```cpp
void qpDecodeW(const wchar_t *charset);
```

The utf-16 version of the qpDecode method.

### CkString.qpEncode

`Chilkat 11.7.0 · cpp · CkString · qpEncode · method`

```cpp
void qpEncode(const char *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 · cpp · CkString · qpEncodeW · method`

```cpp
void qpEncodeW(const wchar_t *charset);
```

The utf-16 version of the qpEncode method.

### CkString.removeAll

`Chilkat 11.7.0 · cpp · CkString · removeAll · method`

```cpp
int removeAll(CkString &substr);
```

Removes all occurrences of `substr`.

### CkString.removeCharOccurances

`Chilkat 11.7.0 · cpp · CkString · removeCharOccurances · method`

```cpp
void removeCharOccurances(char ch);
```

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

### CkString.removeChunk

`Chilkat 11.7.0 · cpp · CkString · removeChunk · method`

```cpp
void removeChunk(int charStartPos, int numChars);
```

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

### CkString.removeDelimited

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

```cpp
void removeDelimited(const char *beginDelim, const char *endDelim, bool caseSensitive);
```

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

### CkString.removeFirst

`Chilkat 11.7.0 · cpp · CkString · removeFirst · method`

```cpp
bool removeFirst(CkString &substr);
```

Removes the first occurrence of a substring.

### CkString.replaceAll

`Chilkat 11.7.0 · cpp · CkString · replaceAll · method`

```cpp
int replaceAll(CkString &findStrObj, CkString &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 · cpp · CkString · replaceAllOccurances · method`

```cpp
int replaceAllOccurances(const char *findStr, const char *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 · cpp · CkString · replaceAllOccurancesW · method`

```cpp
int replaceAllOccurancesW(const wchar_t *pattern, const wchar_t *replacement);
```

The utf-16 version of the replaceAllOccurances method.

### CkString.replaceChar

`Chilkat 11.7.0 · cpp · CkString · replaceChar · method`

```cpp
void replaceChar(char findCh, char replaceCh);
```

Replaces all occurrences of a specified ANSI character with another.

### CkString.replaceFirst

`Chilkat 11.7.0 · cpp · CkString · replaceFirst · method`

```cpp
bool replaceFirst(CkString &findStrObj, CkString &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 · cpp · CkString · replaceFirstOccurance · method`

```cpp
bool replaceFirstOccurance(const char *findStr, const char *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 · cpp · CkString · replaceFirstOccuranceW · method`

```cpp
bool replaceFirstOccuranceW(const wchar_t *pattern, const wchar_t *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 · cpp · CkString · saveToFile · method`

```cpp
bool saveToFile(const char *path, const char *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 · cpp · CkString · saveToFileW · method`

```cpp
bool saveToFileW(const wchar_t *path, const wchar_t *charset);
```

The utf-16 version of the saveToFile method.

Returns true for success, false for failure.

### CkString.setStr

`Chilkat 11.7.0 · cpp · CkString · setStr · method`

```cpp
void setStr(CkString &s);
```

Replaces the contents of the string with another.

### CkString.setString

`Chilkat 11.7.0 · cpp · CkString · setString · method`

```cpp
void setString(const char *str);
```

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

### CkString.setStringAnsi

`Chilkat 11.7.0 · cpp · CkString · setStringAnsi · method`

```cpp
void setStringAnsi(const char *s);
```

Set the CkString object from an ANSI string.

### CkString.setStringU

`Chilkat 11.7.0 · cpp · CkString · setStringU · method`

```cpp
void setStringU(const wchar_t *unicode);
```

Set the CkString object from a Unicode string.

### CkString.setStringUtf8

`Chilkat 11.7.0 · cpp · CkString · setStringUtf8 · method`

```cpp
void setStringUtf8(const char *s);
```

Set the string object from a utf-8 string.

### CkString.shorten

`Chilkat 11.7.0 · cpp · CkString · shorten · method`

```cpp
void shorten(int n);
```

Discards the last N characters.

### CkString.split

`Chilkat 11.7.0 · cpp · CkString · split · method`

```cpp
CkStringArray *split(char delimiterChar, bool exceptDoubleQuoted, bool exceptEscaped, bool 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.

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.split2

`Chilkat 11.7.0 · cpp · CkString · split2 · method`

```cpp
CkStringArray *split2(const char *delimiterChars, bool exceptDoubleQuoted, bool exceptEscaped, bool keepEmpty);
```

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

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.split2W

`Chilkat 11.7.0 · cpp · CkString · split2W · method`

```cpp
CkStringArray *split2W(const wchar_t *splitCharSet, bool exceptDoubleQuoted, bool exceptEscaped, bool keepEmpty);
```

The utf-16 version of the split2 method.

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.splitAtWS

`Chilkat 11.7.0 · cpp · CkString · splitAtWS · method`

```cpp
CkStringArray *splitAtWS(void);
```

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

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.substring

`Chilkat 11.7.0 · cpp · CkString · substring · method`

```cpp
CkString *substring(int startCharIndex, int numChars);
```

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

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.toCRLF

`Chilkat 11.7.0 · cpp · CkString · toCRLF · method`

```cpp
void toCRLF(void);
```

Converts all line endings to CRLF.

### CkString.tokenize

`Chilkat 11.7.0 · cpp · CkString · tokenize · method`

```cpp
CkStringArray *tokenize(const char *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

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.tokenizeW

`Chilkat 11.7.0 · cpp · CkString · tokenizeW · method`

```cpp
CkStringArray *tokenizeW(const wchar_t *punctuation);
```

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

Note: The application is responsible for deleting (via the C++ delete operator) the object returned by this method.

Returns `NULL` on failure

### CkString.toLF

`Chilkat 11.7.0 · cpp · CkString · toLF · method`

```cpp
void toLF(void);
```

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

### CkString.toLowerCase

`Chilkat 11.7.0 · cpp · CkString · toLowerCase · method`

```cpp
void toLowerCase(void);
```

Converts the string to lowercase.

### CkString.toUpperCase

`Chilkat 11.7.0 · cpp · CkString · toUpperCase · method`

```cpp
void toUpperCase(void);
```

Converts the string to uppercase.

### CkString.trim

`Chilkat 11.7.0 · cpp · CkString · trim · method`

```cpp
void trim(void);
```

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

### CkString.trim2

`Chilkat 11.7.0 · cpp · CkString · trim2 · method`

```cpp
void trim2(void);
```

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

### CkString.trimInsideSpaces

`Chilkat 11.7.0 · cpp · CkString · trimInsideSpaces · method`

```cpp
void trimInsideSpaces(void);
```

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

```cpp
void unobfuscate(void);
```

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

```cpp
void urlDecode(const char *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 · cpp · CkString · urlDecodeW · method`

```cpp
void urlDecodeW(const wchar_t *charsetEncoding);
```

The utf-16 version of the urlDecode method.

### CkString.urlEncode

`Chilkat 11.7.0 · cpp · CkString · urlEncode · method`

```cpp
void urlEncode(const char *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 · cpp · CkString · urlEncodeW · method`

```cpp
void urlEncodeW(const wchar_t *charsetEncoding);
```

The utf-16 version of the urlEncode method.

## Related classes

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

