ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / String functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Remark: These functions are also available in prefix syntax (String functions (prefix syntax)).
The following functions handle character strings:
AnsiToOemConverts an ANSI string (Windows) to an OEM string (DOS).
AnsiToUnicodeConverts:
  • an ANSI string (Windows) to a UNICODE string.
  • a buffer containing an ANSI string (Windows) to a buffer containing a UNICODE string.
AscReturns the ASCII code of the specified character.
BufferToHexaConverts a buffer to a hexadecimal string (e.g.,: "4A 5B 00").
BufferToIntegerExtracts an integer from a binary buffer at a given position.
BufferToPhraseConverts a buffer to a mnemonic phrase using the BIP39 algorithm.
BufferToRealExtracts a real from a binary buffer at a given position.
CapitalizeEachWordCapitalizes the first letter of all words in a string.
CharactReturns the character corresponding to the specified ASCII code.
CharactTypeReturns information about the type of character.
CharactTypeCountReturns the number of characters matching a given type.
CharactUnicodeReturns the character corresponding to the specified Unicode code.
CommonLengthReturns the number of common characters between two strings (from the beginning or from the end of the string).
CompleteReturns a character string of a specified length.
CompleteDirAdds a backslash to the end of a string, if necessary.
ContainsAllows you to check if a substring is within a string.
ExtractLineExtracts a specific line from a character string.
ExtractStringAllows you to:
  • extract a substring from a string based on a specified string separator.
  • search for substrings in a string based on a specified string separator.
ExtractStringBetweenAllows you to:
  • extract a substring between two given separators from a character string.
  • search for substrings between two given separators in a character string.
HexaToBufferConverts a string with hexadecimal bytes to a binary buffer.
HexaToIntReturns the numeric value of a hexadecimal string.
HTMLToRTFConverts an HTML string or an HTML buffer to an RTF string.
HTMLToTextConverts an HTML string or buffer to text.
IntToHexaReturns the hexadecimal string of a numeric value.
JSONToStringConverts the content of a JSON variable to a JSON string.
JSONToVariantConverts a JSON string to a Variant variable.
JSONValidChecks the validity of a JSON string.
LeftExtracts the left part (i.e., the first characters) from a string or buffer.
LengthReturns:
  • the length of a string, i.e., the number of characters in the string (including spaces and binary zeros).
  • the size of a buffer, i.e., the number of bytes in the buffer.
LengthToStringConverts a size in bytes to a string with human-readable units such as kilobytes, megabytes or terabytes.
LineToPositionReturns the position of the first character of a line in a block of text.
LowerConverts all characters in a string to lowercase according to the region settings defined in Windows.
New in version 2024
MarkdownLink
Adds a clickable link in a Markdown string. This makes it possible to add a link in a control that supports Markdown format.
MarkdownToDOCXConverts a Markdown string to a DOCX file.
MarkdownToHTMLConverts a Markwdown string to an HTML buffer (encoded in UTF-8).
MarkdownToPDFConverts a Markdown string (or buffer) to a buffer containing a PDF document.
MarkdownToTextConverts a Markdown string to plain text (without tags).
MatchRegularExpressionChecks whether a character string matches a specific format and retrieves the different substrings that match the format.
MiddleExtracts:
  • a substring from a string starting at a specified position.
  • part of a buffer starting at a specified position.
NoAccentConverts accented characters in a string to non-accented characters.
NoCharacterReturns a string after removing the specified leading and trailing characters.
NoLeftCharacterReturns a string after removing the specified characters from the left side of the initial string.
NoRightCharacterReturns a string after removing the specified characters from the right side of the initial string.
NoSpaceReturns a string after removing the spaces:
  • from the left and right side of the initial string.
  • within the string.
NumberInWordsConverts a number to words.
NumToFinancialWritingChineseConverts a numeric value (integer, real or currency) to a string in the Chinese financial writing format.
NumToStringConverts a numeric value (integer, real or currency) to a string according to a specified format.
OemToAnsiConverts an OEM string (DOS) to an ANSI string (Windows).
PhoneticReturns the phonetic transcription of the string passed as parameter.
PhraseToBufferReturns the buffer encoded in a BIP39 mnemonic phrase.
PositionFinds the position of a specified string within another string.
PositionOccurrenceFinds the Xth position of a string within another string.
PositionToLineReturns the number of the line that contains a character identified by its position in a block of text.
RegexMatchChecks whether a string matches the format defined by a regular expression.
RegexReplaceReplaces all the parts of a string that follow a specific format.
RegexSearchSearches for all the parts of a string that follow a specific format.
RepeatStringConcatenates N number of copies of the same specified string or buffer.
ReplaceReplaces all occurrences of a specified substring in a string with another specified substring.
ReverseReturns the character that corresponds to the difference between the ASCII code of a specific character in a string and 255.
RightExtracts the last characters from a string or string buffer.
StringBuildBuilds a character string from an initial string and parameters.
StringCompareCompares two strings character by character:
  • according to the sequence of ASCII characters.
  • according to the alphabetical order.
StringCountCalculates:
  • the number of occurrences of a specific character string (by respecting the search criteria) in another character string.
  • the number of occurrences of a set of strings in an array.
StringDeleteDeletes:
  • all the occurrences of a substring within a string.
  • part of a string within another string. The part of the string to remove is identified by its position and length.
StringDeleteDuplicateRemoves duplicates among substrings of a string, based on one or more separators.
StringEndsWithChecks whether a character string ends:
  • with a specific character string.
  • with one of the character strings in an array.
StringFormatFormats a character string according to the selected options.
StringIncrementIncrements a number at the beginning or at the end of a string.
StringInsertInserts a string into another character string at a given position.
StringRetrieveRetrieves a character string in a format external to PC Soft (character string that is the result of a Windows API for example).
StringReverseReverses the characters of a string.
StringSplitExtracts all the substrings from a character string based on one or more string separators.
StringStartsWithChecks whether a character string starts:
  • with a specific character string.
  • with one of the character strings in an array.
StringToJSONConverts a JSON string into a JSON variable.
StringToNumReturns the numeric value of a character string. This feature enables you to perform numeric calculations on strings.
StringToUTF8Converts an ANSI or UNICODE string to UTF-8.
SystemIntegerToIntegerConverts a system integer to a 4-byte integer.
TextToHTMLConverts text to HTML (carriage returns are replaced by <BR>, accented characters are replaced by their equivalent in HTML, etc.).
TextToRTFConverts text to Rich Text Format.
TruncateTruncates the right part of a string or buffer.
UncompleteDirRemoves the '/' or '\' characters from the end of a string, if necessary.
UnicodeToAnsiConverts:
  • a UNICODE string to ANSI (Windows).
  • a buffer containing a UNICODE string to a buffer containing an ANSI string (Windows).
UpperConverts all characters in a string to uppercase according to the region settings defined in Windows.
URLDecodeDecodes an encoded URL (which means with characters in %xx format).
URLEncodeEncodes a URL with a sub-set of ASCII characters.
URLExtractPathReturns the different elements of a URL: protocol, user, password, domain, port, resource path, resource name, resource extension, request and fragment.
UTF8ToAnsiConverts a UTF-8 string to ANSI.
UTF8ToStringConverts a UTF-8 string to ANSI or UNICODE.
UTF8ToUnicodeConverts a UTF-8 string to Unicode
New in version 2024
UTF8Valid
Checks the validity of a UTF-8 string.
UTFConvertConverts a string or buffer to the specified format: UTF, ANSI, Unicode.
ValReturns the numeric value of a character string.
VariantToJSONConverts the content of a Variant variable to JSON.
WordCountReturns the number of words in a string.
WordToArrayFills an array with the words from a string.
Other functions can also be used to handle character strings:
ArrayToStringConverts a one- or two-dimensional array to a character string.
DeserializeDeserializes a buffer or string containing the data of a class, structure or array and their subelements.
StringToArrayFills a one- or two-dimensional array with the content of a string.
StringToDateConverts a date in character string format to a date in YYYYMMDD format.
TextToXMLConverts an ANSI string to an XML string.
XMLToTextConverts an XML string to an ANSI string.
Related Examples:
The HTMLTo functions Unit examples (WEBDEV): The HTMLTo functions
[ + ] This example explains how to use the HTMLToRTF and HTMLToText functions of WLanguage.
The Val function Unit examples (WINDEV): The Val function
[ + ] Using the WLanguage "Val" function with different databases.
For example, it allows you to retrieve the decimal value of a string in Hexadecimal format.
The standard functions on strings Unit examples (WINDEV): The standard functions on strings
[ + ] Using the main functions for handling character strings:
- Position and PositionOccurrence
- Replace
- StringBuild
- Left, Right, Middle
- ExtractString
Complex strings Unit examples (WINDEV): Complex strings
[ + ] Implementing the building of complex strings with StringBuild.
Strings with APIs Unit examples (WINDEV): Strings with APIs
[ + ] Using strings with APIs.
The following functions are used:
- StringRetrieve
- Transfer
The encryption functions Unit examples (WINDEV): The encryption functions
[ + ] Using the encryption/decryption functions of WINDEV.
This example is used to:
- Encrypt a character string
- Decrypt a character string
WD Input checks Training (WINDEV): WD Input checks
[ + ] This example presents the manage of the input checks with the WLanguage functions.
The following topics are presented in this example:
1/ the functions for handling the strings
2/ the use of the file that groups the French cities

Summary of the example supplied with WINDEV:
This program, powered by WINDEV, explains how to check the data entered by the user: name, company, zip code, city, email address, and so on.
This example contains several procedures that can be easily reused.
The file containing 39 000 zip codes and cities is supplied with this example
The regular expressions Unit examples (WINDEV): The regular expressions
[ + ] Using regular expressions with WINDEV.
Two use modes are presented for the regular expressions:
- checking the input format
- checking out different elements while respecting the input format.
This example is also used to search for a word in a string. The search can be case-sensitive or not. Possibility to take into account (or not) the start or end of string, as well as spaces (anywhere in the string, even in the sought word)
The regular expressions Unit examples (WINDEV Mobile): The regular expressions
[ + ] Using regular expressions with WINDEV Mobile.
It presents 2 modes for using the regular expressions:
- check the input format
- check out the different elements that match the input format.
This example is also used to search for a word in a string. The search can be case-sensitive or not. Possibility to take into account (or not) the start or end of string, as well as spaces (anywhere in the string, even in the sought word)
The encryption functions Unit examples (WINDEV Mobile): The encryption functions
[ + ] Using the WLanguage encryption and decryption functions.
This example is used to:
- Encrypt a character string
- Decrypt a character string
The encryption functions Unit examples (WEBDEV): The encryption functions
[ + ] This example explains how to use the encryption/decryption functions of WEBDEV. This example allows you to:
- Encrypt a character string
- Decrypt a character string
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/06/2024

Send a report | Local help