- Middle and UNICODE
- Miscellaneous
- Differences between GO mode and runtime
Middle (Function) In french: Milieu
// Extract characters Middle("Eponine", 2, 3) // Returns "pon" Middle("Eponine", 2) // Returns "ponine" Middle("Eponine", 50) // Returns "" Middle("Eponine", 2, 50) // Returns "ponine" // Equivalent to // MyString is string = Eponine // MyString = MyString[[2,50]]
MyString is string = "Antananarivo - Madagascar" Middle(MyString, 10, 7) // Returns "ivo - M"
Syntax
Extracting a substring from a string Hide the details
<Result> = Middle(<Initial string> , <Start position> [, <Length>])
<Result>: Character string - Part of <Initial string>.
- Empty string ("") if <Start position> is greater than the length of <Initial string>.
- EOT if <Start position> and/or <Length> are negative. A WLanguage error occurs (non-fatal error). To get the details of the error, use ErrorInfo.
<Initial string>: Character string Character string containing the substring to extract. This string is not modified. <Start position>: Integer Position of the first character to extract. If <Start position> is null, the extraction starts at the beginning of the string. <Length>: Optional integer Number of characters to extract. If this parameter is not specified or is greater than the number of characters after <Start position>, the string is returned from <Start position>. Remarks Middle and UNICODE If the string passed as a parameter is in ANSI format, the result will be in ANSI format. If the string passed as a parameter is in UNICODE format, the result will be in UNICODE format. Reminder: In UNICODE, each character occupies two bytes of memory. Therefore, the memory footprint of a UNICODE string is twice the number of characters actually contained in the string. The fist character in the string is at index 1. Remark: If the result on an ANSI string is assigned to a UNICODE string (and conversely), the conversion will be implicitly performed. Miscellaneous The same feature can be obtained with the [[]] operator.
This page is also available for…
|
|
|