CkString VB.NET Reference Documentation

CkString

Current Version: 9.5.0.73

The Chilkat string class.

Object Creation

Dim obj As New Chilkat.CkString()

Methods

append
Sub append(ByVal str As String)

The str is appended to end of this instance.

top
appendInt
Sub appendInt(ByVal n As Integer)

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

top
appendObfuscated
Sub appendObfuscated(ByVal obfuscatedStr As String)

Unobfuscates and appends obfuscatedStr to the end of this instance.

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.

top
autoLinkUrls
Sub autoLinkUrls()

Searches the string for URLS (http://..., https://...) and auto-links them. For example, if "http://www.chilkatsoft.com/" is found in the string, it is replaced with "http://www.chilkatsoft.com/" URLs that are already linked are not modified.

top
base64Decode
Sub base64Decode(ByVal charsetEncoding As String)

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

More Information and Examples
top
base64Encode
Sub base64Encode(ByVal charsetEncoding As String)

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.

More Information and Examples
top
beginsWith
Function beginsWith(ByVal substr As String) As Boolean

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

top
charAt
Function charAt(ByVal idx As Integer) As char

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

top
chopAtFirstChar
Sub chopAtFirstChar(ByVal ch As char)

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

top
clear
Sub clear()

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

top
containsSubstring
Function containsSubstring(ByVal substr As String) As Boolean

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

top
containsSubstringNoCase
Function containsSubstringNoCase(ByVal substr As String) As Boolean

Same as containsSubstring except the matching is case insensitive.

top
decodeXMLSpecial
Sub decodeXMLSpecial()

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

top
doubleValue
Function doubleValue() As double

Converts the string to a double and returns the value.

top
eliminateChar
Sub eliminateChar(ByVal ansiChar As char, ByVal startIndex As Integer)

Eliminate all occurrences of a particular ANSI character.

top
encodeXMLSpecial
Sub encodeXMLSpecial()

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

top
entityDecode
Sub entityDecode()

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

top
entityEncode
Sub entityEncode()

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

top
equals
Function equals(ByVal str As String) As Boolean

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

top
equalsIgnoreCase
Function equalsIgnoreCase(ByVal str As String) As Boolean

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

top
getNumChars
Function getNumChars() As Integer

Returns the number of characters in the string.

top
getSizeAnsi
Function getSizeAnsi() As Integer

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

top
getSizeUnicode
Function getSizeUnicode() As Integer

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

top
getSizeUtf8
Function getSizeUtf8() As Integer

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

top
getString
Function getString() As mbString

Returns the contents of this instance.

top
hexDecode
Sub hexDecode(ByVal charsetEncoding As String)

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

More Information and Examples
top
hexEncode
Sub hexEncode(ByVal charsetEncoding As String)

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

More Information and Examples
top
intValue
Function intValue() As Integer

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

top
loadFile
Function loadFile(ByVal path As String, ByVal charsetEncoding As String) As Boolean

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.

More Information and Examples
top
loadXmlFile
Function loadXmlFile(ByVal path As String) As Boolean

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

Returns True for success, False for failure.

top
obfuscate
Sub 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.

top
prepend
Sub prepend(ByVal str As String)

Prepends str to this instance.

top
punyDecode
Sub punyDecode()
Introduced in version 9.5.0.52

In-place decodes the string from punycode.

More Information and Examples
top
punyEncode
Sub punyEncode()
Introduced in version 9.5.0.52

In-place encodes the string to punycode.

More Information and Examples
top
qpDecode
Sub qpDecode(ByVal charsetEncoding As String)

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.

More Information and Examples
top
qpEncode
Sub qpEncode(ByVal charsetEncoding As String)

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.

More Information and Examples
top
removeCharOccurances
Sub removeCharOccurances(ByVal ch As char)

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

top
removeChunk
Sub removeChunk(ByVal charStartPos As Integer, ByVal numChars As Integer)

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

top
removeDelimited
Sub removeDelimited(ByVal beginDelim As String, ByVal endDelim As String, ByVal caseSensitive As Boolean)
Introduced in version 9.5.0.52

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

top
replaceAllOccurances
Function replaceAllOccurances(ByVal findStr As String, ByVal replaceStr As String) As Integer

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

top
replaceChar
Sub replaceChar(ByVal findCh As char, ByVal replaceCh As char)

Replaces all occurrences of a specified ANSI character with another.

top
replaceFirstOccurance
Function replaceFirstOccurance(ByVal findStr As String, ByVal replaceStr As String) As Boolean

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

top
saveToFile
Function saveToFile(ByVal path As String, ByVal charsetEncoding As String) As Boolean

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.

More Information and Examples
top
setString
Sub setString(ByVal str As String)

Clears the contents of this instance and appends str.

top
shorten
Sub shorten(ByVal n As Integer)

Discards the last N characters.

top
toCRLF
Sub toCRLF()

Converts all line endings to CRLF.

top
toLF
Sub toLF()

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

top
toLowerCase
Sub toLowerCase()

Converts the string to lowercase.

top
toUpperCase
Sub toUpperCase()

Converts the string to uppercase.

top
trim
Sub trim()

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

top
trim2
Sub trim2()

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

top
trimInsideSpaces
Sub 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.

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

top
urlDecode
Sub urlDecode(ByVal charsetEncoding As String)

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

More Information and Examples
top
urlEncode
Sub urlEncode(ByVal charsetEncoding As String)

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.

More Information and Examples
top