This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / String functions
  • What is UNICODE
  • Managing UNICODE
  • Implicit conversions
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
UNICODE is an encoding system that assigns a unique number to each character:
  • This system uses a 16-bit encoding.
  • This number can be read regardless of the platform, software or language used.
Unicode supports most of the world's writing systems.
Unicode is used:
  • for character strings
  • for data files
  • for controls that display data from character strings or data files.
Managing UNICODE
To use the UNICODE standard, WINDEV includes:
  • an option to define the string format at runtime in the project configuration description.
    To change the string format in the current configuration:
    1. Display the project description window: under the "Project" pane, in the "Project configuration" group, click on "Current configuration"..
    2. In the window that appears, select the "Unicode" tab and choose the desired mode: "Use ANSI strings at runtime" or "Use UNICODE strings at runtime".
  • the UNICODE String type.
  • conversion functions:
    These functions convert ANSI characters to Unicode and vice versa. Character strings are automatically converted (see paragraph below).
    • an ANSI string (Windows) to a UNICODE string.
    • a buffer containing an ANSI string (Windows) to a buffer containing a UNICODE string.
    StringToUTF8Converts an ANSI or UNICODE string to UTF-8.
    • a UNICODE string to ANSI (Windows).
    • a buffer containing a UNICODE string to a buffer containing an ANSI string (Windows).
    UTF8ToStringConverts a UTF-8 string to ANSI or UNICODE.
  • functions to handle character strings:
    CompleteReturns a character string of a specified length.
    CompleteDirAdds a backslash to the end of a string, if necessary.
    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.
    LeftExtracts the left part (i.e., the first characters) from a string or buffer.
    • 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.
    • 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.
    NoSpaceReturns a string after removing the spaces:
    • from the left and right side of the initial string.
    • within the string.
    PositionFinds the position of a specified string within another string.
    PositionOccurrenceFinds the Xth position of a string within another string.
    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.
    StringCompareCompares two strings character by character:
    • according to the sequence of ASCII characters.
    • according to the alphabetical order.
    • 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.
    StringFormatFormats a character string according to the selected options.
    TypeVarIdentifies the type of an expression, a variable (during a call to a procedure for example) or a control.
    ValReturns the numeric value of a character string.
  • the use of operators for handling character strings:
  • operators to iterate over character strings:
  • the use of functions for handling text files:
    fOpenOpens an external file (ANSI or Unicode) to handle it programmatically.
    fReadReads a block of bytes (characters) from an external file (ANSI or UNICODE).
    fReadLineReads a line from an external file (ANSI or UNICODE).
    fWriteWrites a string to an external file (ANSI or UNICODE).
    fWriteLineWrites a line to a text file (ANSI or UNICODE).

Implicit conversions

Starting with version 12, ANSI and Unicode strings are automatically converted. These conversions are performed using the current character set (defined with ChangeCharset).
From version 15 onwards, UNICODE character strings are automatically converted when assigning one of the following types to an HFSQL field: Boolean, integer (all sizes, with or without sign), monetary, numeric or real.
Use cases:
// Avec les fonctions de conversion
ResU is string Unicode = AnsiVersUnicode("Test d'une chaîne")
// Conversion implicite
ResU is string Unicode = "Test d'une chaîne"
Res is string
ResU is string Unicode
// Avec les fonctions de conversion
ResU = AnsiToUnicode(Res)
Res = UnicodeToAnsi(ResU)
// Conversion implicite
ResU = Res
Res = ResU
Res is string
ResU is string Unicode
// Avec les fonctions de conversion
IF ResU <> AnsiToUnicode("") THEN ...
IF ResU <> AnsiToUnicode(Res) THEN ...
// Conversion implicite
IF ResU <> "" THEN ...
IF ResU <> Res THEN ...
nFic is int = fOuvre("E:\temp\Unicode.txt", foRead + foUnicode)
ResU is string Unicode
ResU = fReadLine(nFic)
	ResU = fReadLine(nFic)
Minimum version required
  • Version 9
This page is also available for…
Click [Add] to post a comment

Last update: 07/18/2024

Send a report | Local help