Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Len – PB Docs 126 – PowerBuilder Library

Len – PB Docs 126

Len PowerScript function

Description

Reports the length of a string or a blob.

Syntax

Argument

Description

stringorblob

The string or blob for which you want
the length in number of characters or in number of bytes

Return Values

Long. Returns a long whose value is the
length of stringorblob if it succeeds and -1
if an error occurs. If stringorblob is null, Len returns null.

Usage

Len counts the number of characters in
a string. The null that terminates a string is
not included in the count.

If you specify a size when you declare a blob, that is the
size reported by Len. If you do not specify a
size for the blob, Len initially reports the
blob’s length as 0. PowerBuilder assigns a size to the
blob the first time you assign data to the blob. Len reports
the length of the blob as the number characters it can contain.

Examples

This statement returns 0:

These statements store in the variable s_address_len the
length of the text in the SingleLineEdit sle_address:

The following scenarios illustrate how the declaration
of blobs affects their length, as reported by Len.

In the first example, an instance variable called ib_blob is
declared but not initialized with a size. If you call Len before
data is assigned to ib_blob, Len returns
0. After data is assigned, Len returns the blob’s
new length.

The declaration of the instance variable is:

The sample code is:

In the second example, ib_blob is
initialized to the size 100 when it is declared. When you call Len
for ib_blob, it always returns 100.
This example uses BlobEdit, instead of Blob,
to assign data to the blob because its size is already established.
The declaration of the instance variable is:

The sample code is:

See Also

Len method for DataWindows in
the DataWindow Reference or the online Help


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x