Storages & Files String and UnicodeString properties
String and Unicode String Indexed, Read/Write properties.

Gets/sets a string with the specified length in the buffer.

Syntax:

object.String(index[,length,[cp]]) = value
variable =
object.String(index[,length,[cp]])

object.UnicodeString(index[,length]) = value
variable =
object.UnicodeString(index[,length])

Parameters:

index - numeric index of the byte in the memory buffer where the string begins

length - the length of the string to read/write in characters. Default is -1. In that case the size is the string length plus 1 (with the zero character). When the length is specified the string is padded with zeros if it is shorter than the length specified, but no zero character is appended if the string is longer or equal to the length parameter.

cp - code page (ANSI strings only) to be used for conversion. See more details in the description of the SFStream.codePage property.

Remarks:

This property allows you to read/write strings in random positions in the buffer. Specifying the length you can fill or read fields in file headers for example. When the UnicodeString is used the bytes in the wide characters are automatically reordered as specified by the UnicodeByteOrder property.

When the length is -1 the size is calculated automatically. When writing this is quite clear, when reading this means the method will try to find the first 0-character after the index specified or will return all the data to the end of the buffer as string.

Applies to: SFBinaryData object

See also: UnicodeByteOrder property.

Supported on:

Windows 95/NT and later
Windows CE 3.0 and later
Pocket PC/Windows Mobile 2003 and later
Windows CE.NET 4 and later

 

newObjects Copyright 2001-2006 newObjects [ ]