StrJustify

System Module

Description: Performs a word-wrap such that the string will break on or before each multiple of the maximum line length.
Returns: Text
Usage: Script Only.
Function Groups: String and Buffer
Related to: StrLen
Format: System.StrJustify(Str [, Width])
Parameters:  
Str
Required. The string to be formatted.
Width
An optional parameter indicating the maximum width for line length. If Width is Invalid, the width will be taken from the PrintWidth Setup.ini variable (see "Setup.ini [SYSTEM] Section Variables").
Comments: Inserts CR LF characters (0D 0A), either at each multiple of Width characters or after the first space (20) preceding Width characters.

Examples:

If Watch(1); 
  [ 
    var1 = "AllDayLong"; 
    var2 = System.StrJustify(var1, 6); 
    var3 = "AllDay Long"; 
    var4 = System.StrJustify(var3, 6); 
    var5 = "All Day Long"; 
    var6 = System.StrJustify(var5, 6); 
  ]

After running, the byte codes of var1 through var 6 are:

var1:   41 6C 6C 44 61 79 4C 6F 6E 67
var2:   41 6C 6C 44 61 79 0D 0A 4C 6F 6E 67
var3:   41 6C 6C 44 61 79 20 4C 6F 6E 67
var4:   41 6C 6C 44 61 79 0D 0A 20 4C 6F 6E 67
var5:   41 6C 6C 20 44 61 79 20 4C 6F 6E 67
var6:   41 6C 6C 20 0D 0A 44 61 79 20 0D 0A 4C 6F 6E 67