Purpose |
Center a
|
Syntax |
CSET [ABS] result_var = string_expression [USING string_expression] |
Remarks |
CSET centers a string into the space of another string or variable of a User-Defined Type. |
ABS |
If ABS is specified, or ustring_expression is null (empty), CSET leaves the padding positions unchanged from their original content, rather than replacing them with spaces. |
USING |
If string_expression is shorter then result_var, CSET centers string_expression within result_var, padding both sides with the first character in ustring_expression, or spaces if not specified. If string_expression is longer than result_var, CSET truncates string_expression from the right until it fits in result_var. CSET can be used to assign the content of a User-Defined Type to a User-Defined Type variable of a different class, or assign a dynamic string to a User-Defined Type. For example: CSET MyType = MyType2 CSET MyType = a$ LSET and RSET work similarly, but performs left and right-justification respectively. |
See also |
CSET$, GET, LET, LET (With Types), LSET, LSET$, PUT, RESET, RSET, RSET$, STRINSERT$, TYPE SET |
Example |
a$ = RTRIM$(REPEAT$(5,"COOL ")) CSET ABS a$ = "..PowerBASIC.." ' result: "COOL ..PowerBASIC.. COOL" CSET a$ = "PowerBASIC" USING "*" ' result: "*******PowerBASIC*******" |