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

String and char datatypes in PowerBuilder – PB Docs 125 – PowerBuilder Library

String and char datatypes in PowerBuilder – PB Docs 125

String and char datatypes in PowerBuilder

General information

There is no explicit char literal type.

String literals convert to type char using
the following rules:

  • When a string literal is assigned to a char variable,
    the first character of the string literal is assigned to the variable.
    For example:

    results in the character x being assigned
    to the char variable c.

  • Special characters (such as newline, formfeed, octal,
    hex, and so on) can be assigned to char variables
    using string conversion, such as:

String variables assigned to char variables also convert using
these rules. A char variable assigned to a string variable results
in a one-character string.

Assigning strings to char arrays

As with other datatypes, you can use arrays of chars.
Assigning strings to char arrays follows these rules:

  • If the char array is unbounded (defined as a variable-size
    array), the contents of the string are copied directly into the
    char array.

  • If the char array is bounded and its length is less
    than or equal to the length of the string, the string is truncated
    in the array.

  • If the char array is bounded and its length is greater
    than the length of the string, the entire string is copied into
    the array along with its zero terminator. Remaining characters in
    the array are undetermined.

Assigning char arrays to strings

When a char array is assigned to a string variable, the contents
of the array are copied into the string up to a zero terminator,
if found, in the char array.

Using both strings and chars in an expression

Expressions using both strings and char arrays promote the
chars to strings before evaluation. For example, the following promotes
the contents of c to a string before comparison
with the string “x”:

Using chars in PowerScript functions

All PowerScript functions that take strings also take chars
and char arrays, subject to the conversion rules described above.


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