PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Types of strings
  • Special case
  • Fixed string and ASCIIZ string
  • Processing fixed strings
  • Notes
  • Default value
  • Passing a string in parameter to a procedure
  • Using quotes in a character string
  • Comparing the different types of strings available in WINDEV and in WINDEV Mobile
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Types of strings
WLanguage proposes different types of character strings.
1. The most common types are as folllows:
  • Character
Character coded on 1 byte.
Character coded on 1, 2 or 4 bytes according to the management mode of strings and to the runtime platform.
  • In Windows:
    • in Ansi mode, a character is coded on 1 byte,
    • in Unicode mode, a character is coded on 2 bytes.
  • In Linux:
    • in Ansi mode, a character is coded on 1 byte,
    • in Unicode mode, a character is coded on 4 bytes.
  • In iOS, in Unicode, a character is coded on 4 bytes.
When a character is empty, its value corresponds to Charact(0).
PHP When a character is empty, its value corresponds to empty string.
Versions 17 and later
WINDEVWEBDEV - Server code Note:
  • If the current configuration is using ANSI strings at run time, the Character variables will be ANSI characters (default operating mode).
  • If the current configuration is using Unicode strings at run time, the Character variables will be Unicode characters.
Reminder: To modify the management of strings in the current configuration:
  1. Display the description window of project ("Project .. Project description"). Display the description window of project: on the "Project" pane, in the "Project" group, click "Description".
  2. In the "Project" tab, click the "Description of current configuration" button.
  3. In the window that is displayed, display the "Unicode" tab.
New in version 17
WINDEVWEBDEV - Server code Note:
  • If the current configuration is using ANSI strings at run time, the Character variables will be ANSI characters (default operating mode).
  • If the current configuration is using Unicode strings at run time, the Character variables will be Unicode characters.
Reminder: To modify the management of strings in the current configuration:
  1. Display the description window of project ("Project .. Project description"). Display the description window of project: on the "Project" pane, in the "Project" group, click "Description".
  2. In the "Project" tab, click the "Description of current configuration" button.
  3. In the window that is displayed, display the "Unicode" tab.
WINDEVWEBDEV - Server code Note:
  • If the current configuration is using ANSI strings at run time, the Character variables will be ANSI characters (default operating mode).
  • If the current configuration is using Unicode strings at run time, the Character variables will be Unicode characters.
Reminder: To modify the management of strings in the current configuration:
  1. Display the description window of project ("Project .. Project description"). Display the description window of project: on the "Project" pane, in the "Project" group, click "Description".
  2. In the "Project" tab, click the "Description of current configuration" button.
  3. In the window that is displayed, display the "Unicode" tab.
WEBDEV - Browser codeAndroidAndroid Widget Universal Windows 10 AppJava The Character type is not supported. It is replaced by the String type.
  • Versions 17 and later
    Ansi string
    New in version 17
    Ansi string
    Ansi string
Dynamic-size string containing characters in ANSI format only.
This format is required to handle:
  • the XML files
  • the RTF files
  • the PDF files
  • the functions that use the UTF8 format, ...
Windows Mobile Notes:
  • The Ansi strings can be used only if "UNICODE mode in test mode and on the mobile device" is checked.
  • To modify the management mode of strings in the current configuration:
    1. Display the description window of project ("Project .. Project description"). Display the description window of project: on the "Project" pane, in the "Project" group, click "Description".
    2. In the "Project" tab, click the "Description of current configuration" button.
    3. In the window that is displayed, display the "Unicode" tab. You have the ability to check (or not) "UNICODE mode in test mode and on the mobile device".
      Note: Before version 17, Buffer variables had to be used to handle strings in Ansi format.
  • Unicode string
Dynamic-size string containing characters in UNICODE format only.
WINDEVWEBDEV - Server code Before version 17 or in a configuration using Ansi strings at run time, this type of string can be returned by AnsiToUnicode or by one of the functions for handling the Unicode strings.
See Managing the Unicode format for more details.
Versions 17 and later
WINDEVWEBDEV - Server code This type of string is used by default if the current configuration is using Unicode strings at run time.
New in version 17
WINDEVWEBDEV - Server code This type of string is used by default if the current configuration is using Unicode strings at run time.
WINDEVWEBDEV - Server code This type of string is used by default if the current configuration is using Unicode strings at run time.
Windows Mobile This type of string is equivalent to the String type.
WEBDEV - Browser codeAndroidAndroid Widget Universal Windows 10 AppJava This type of string is not supported. It is replaced by the String type.
PHP This type of string is not supported.
  • String
Dynamic-size string.

The "string" type is specific to the WLanguage. With this type, there is no need to declare the length of the string. This one can freely change when using the variable.
WINDEVWEBDEV - Server codeWEBDEV - Browser codeJavaPHP This type of string is in ANSI format.
Versions 17 and later
WINDEVWEBDEV - Server code Note:
  • If the current configuration is using ANSI strings at run time, the String variables will be ANSI strings (default operating mode).
  • If the current configuration is using Unicode strings at run time, the String variables will be Unicode strings.
Reminder: To modify the management of strings in the current configuration:
  1. Display the description window of project ("Project .. Project description"). Display the description window of project: on the "Project" pane, in the "Project" group, click "Description".
  2. In the "Project" tab, click the "Description of current configuration" button.
  3. In the window that is displayed, display the "Unicode" tab.
New in version 17
WINDEVWEBDEV - Server code Note:
  • If the current configuration is using ANSI strings at run time, the String variables will be ANSI strings (default operating mode).
  • If the current configuration is using Unicode strings at run time, the String variables will be Unicode strings.
Reminder: To modify the management of strings in the current configuration:
  1. Display the description window of project ("Project .. Project description"). Display the description window of project: on the "Project" pane, in the "Project" group, click "Description".
  2. In the "Project" tab, click the "Description of current configuration" button.
  3. In the window that is displayed, display the "Unicode" tab.
WINDEVWEBDEV - Server code Note:
  • If the current configuration is using ANSI strings at run time, the String variables will be ANSI strings (default operating mode).
  • If the current configuration is using Unicode strings at run time, the String variables will be Unicode strings.
Reminder: To modify the management of strings in the current configuration:
  1. Display the description window of project ("Project .. Project description"). Display the description window of project: on the "Project" pane, in the "Project" group, click "Description".
  2. In the "Project" tab, click the "Description of current configuration" button.
  3. In the window that is displayed, display the "Unicode" tab.
WEBDEV - Browser codeAndroidAndroid Widget iPhone/iPadApple WatchWindows MobileUniversal Windows 10 App This type of string is in Unicode format.
  • Buffer
Binary memory zone. Used to write a code that can be shared between WINDEV and WINDEV Mobile regarding the operations performed on rough data. See The "Buffer" type for more details.
WEBDEV - Browser codeUniversal Windows 10 App The Buffer type is not supported.
2. Other types of strings can also be used:
  • String on
Fixed-length string, ending with a binary 0 (as in C). The specified size corresponds to the maximum number of characters in the string.
This type of string is used to create compatible WINDEV/WINDEV Mobile code when calling APIs found on the two platforms.
WINDEVWEBDEV - Server code This type of string is in ANSI format.
Windows Mobile This type of string is in Unicode format.
  • ASCIIZ string on
String ending with a binary 0 (as in C).
The size of an ASCIIZ string cannot exceed 2 GB. The length given to the ASCIIZ string must be equal to its current length plus 1 (for the binary zero).
Windows Mobile This type of string is not available. We recommend that you use the String On type.
WEBDEV - Browser codeAndroidAndroid Widget Universal Windows 10 AppJava The ASCIIZ String type is not supported. It is replaced by the String type.
  • Fixed string on
Fixed-size string.
The length of a fixed string cannot exceed 2 GB. The string is filled:
  • with 0 if the variable is not assigned yet.
  • with space characters if necessary if the variable is assigned (similar to the "string" type of Basic).
Windows Mobile This type of string is not available. We recommend that you use the String On type.
WEBDEV - Browser codeAndroidUniversal Windows 10 AppJava The Fixed String type is not supported. It is replaced by the String type.
  • Pascal string on
String preceded by a byte that specifies the length (like in Pascal). This byte is not accessible. For example, string[1] represents the first character of the string and not its length.
The length of a Pascal string cannot exceed 255 characters. The size given to the Pascal string must be equal to the size of the string.
Windows Mobile This type of string is not available. We recommend that you use the String On type.
WEBDEV - Browser codeAndroidAndroid Widget Universal Windows 10 AppJava The Pascal String type is not supported. It is replaced by the String type.
  • Unicode string on
Fixed-size string containing characters in UNICODE format.
Windows Mobile This type of string is equivalent to the String On type.
WEBDEV - Browser codeAndroidAndroid Widget Universal Windows 10 AppJava This type of string is not supported. It is replaced by the String type.
PHP This type of string is not supported.
Notes:
  • The "String on" type must be used to send input/output parameters to a Windows API.
  • All the advanced types (other than "String") are available for compatibility with the other programming languages (Turbo Pascal Windows, C, Visual Basic Windows, ...) or to receive the result of a Windows API.
  • WINDEV Mobile and WINDEV do not propose the same types of character strings. See the Notes for more details.
Special case
WINDEVWEBDEV - Server codeReports and QueriesWindowsPHPUser code (UMC)

Fixed string and ASCIIZ string

  • When declaring an ASCIIZ string or a fixed-length string, the necessary memory is immediately allocated. Therefore, you should avoid using very large strings.
  • The fixed string is filled with space characters. The initialization and the assignment of a huge string (several hundreds of kilo bytes) may take quite a long time.
WINDEVWEBDEV - Browser codeWindowsAndroidAndroid Widget Universal Windows 10 AppJava

Processing fixed strings

The fixed strings are not available in Java. They are replaced by the String type at run time.
However, Complete can be used on a String variable:
MyString is string
MyString = Complete("Test", 10)
// Equivalent to
// MyString is fixed string on 10 characters
// MyString = "Test"
Notes

Default value

  • A "String" or "String on" variable that is declared but not initialized corresponds to an empty string ("").
  • A "Buffer" variable that is declared but not initialized is empty.
  • A "Buffer on" variable that is declared but not initialized is filled with 0.

Passing a string in parameter to a procedure

A "String" variable can be passed in parameter to a procedure.
Caution: The space characters must be deleted if the variable is a fixed-length variable. For example:
MyString is string
MyString = "WinDev is great"
// Delete the space characters from MyString
MyString = NoSpace(MyString)
CountLetter(MyString)
// CountLetter is a procedure

Using quotes in a character string

To use the quote character in a character string, this character must be repeated twice.
For example:
MyString is string
MyString = "The ""General conditions"" option must be checked"
Info(MyString)
// Displays: The "General conditions" option must be checked
WINDEVWEBDEV - Server codeReports and QueriesWindowsWindows MobileUser code (UMC)

Comparing the different types of strings available in WINDEV and in WINDEV Mobile

WINDEV/WEBDEV
Format of the string
WINDEV Mobile
Format of the string
StringANSIUnicode
CharacterANSIUnicode
ASCIIZ string onANSI string of N charactersnot available
Fixed string onANSI string of N charactersnot available
Pascal string onANSI string of N charactersnot available
Unicode stringUnicodeUnicode
BufferBinaryBinary
String onANSI string of N charactersUnicode string of N characters
Unicode string onUnicode string of N charactersUnicode string of N characters
Buffer onBinary memo of N bytesBinary memo of N bytes
Related Examples:
Different types of strings Unit examples (WINDEV): Different types of strings
[ + ] Using the different types of strings available in WINDEV.
The specific features of each type are presented in details.
Types used:
- "Standard" string
- UNICODE string
- Fixed string
- Pascal String
- ASCIIZ String
- Buffer type
Minimum version required
  • Version 9
This page is also available for…
Comments
On the side will appear to configure Edge
Ficando em Cima do Controle Static
Apertando a tecla ALT
no lado vai aparecer para configurar Borda
//===========================
Rester dans Static Control Up
ALT Pressing
sur le côté apparaîtra pour configurer Bord
//===========================
Staying on Top of Static Control
Pressing the ALT key
On the side will appear to configure Edge
//===========================

http://windevdesenvolvimento.blogspot.com.br/2017/02/aula-1077-windev-dicas-018-static.html

https://www.youtube.com/watch?v=rlwUQvgbl1Y

De matos
10 Mar. 2017