Done. Changed these functions to:
' ========================================================================================
' Returns a string containing a left-justified (padded) string.
' If the optional parameter wszPadCharacter not specified, the function pads the string with
' space characters to the left. Otherwise, the function pads the string with the first
' character of wszPadCharacter
' Example: DIM cws AS CWSTR = AfxStrLSet("FreeBasic", 20, "*")
' ========================================================================================
PRIVATE FUNCTION AfxStrLSet (BYREF wszMainStr AS WSTRING, BYVAL nStringLength AS LONG, BYREF wszPadCharacter AS WSTRING = " ") AS CWSTR
IF LEN(wszPadCharacter) > 1 THEN wszPadCharacter = LEFT(wszPadCharacter, 1)
DIM cws AS CWSTR = SPACE(nStringLength)
IF wszPadCharacter <> "" THEN
FOR i AS LONG = 1 TO LEN(cws)
MID(**cws, i, 1) = wszPadCharacter
NEXT
END IF
MID(**cws, 1, LEN(wszMainStr)) = wszMainStr
RETURN cws
END FUNCTION
' ========================================================================================
' ========================================================================================
' Returns a string containing a right-justified (padded) string.
' If the optional parameter wszPadCharacter not specified, the function pads the string with
' space characters to the left. Otherwise, the function pads the string with the first
' character of wszPadCharacter.
' Example: DIM cws AS CWSTR = AfxStrRSet("FreeBasic", 20, "*")
' ========================================================================================
PRIVATE FUNCTION AfxStrRSet (BYREF wszMainStr AS WSTRING, BYVAL nStringLength AS LONG, BYREF wszPadCharacter AS WSTRING = " ") AS CWSTR
IF LEN(wszPadCharacter) > 1 THEN wszPadCharacter = LEFT(wszPadCharacter, 1)
DIM cws AS CWSTR = SPACE(nStringLength)
IF wszPadCharacter <> "" THEN
FOR i AS LONG = 1 TO LEN(cws)
MID(**cws, i, 1) = wszPadCharacter
NEXT
END IF
MID(**cws, nStringLength - LEN(wszMainStr) + 1, LEN(wszMainStr)) = wszMainStr
RETURN cws
END FUNCTION
' ========================================================================================
' ========================================================================================
' Returns a string containing a centered (padded) string.
' If the optional parameter wszPadCharacter not specified, the function pads the string with
' space characters to the left. Otherwise, the function pads the string with the first
' character of wszPadCharacter.
' Example: DIM cws AS CWSTR = AfxStrCSet("FreeBasic", 20, "*")
' ========================================================================================
PRIVATE FUNCTION AfxStrCSet (BYREF wszMainStr AS WSTRING, BYVAL nStringLength AS LONG, BYREF wszPadCharacter AS WSTRING = " ") AS CWSTR
IF LEN(wszPadCharacter) > 1 THEN wszPadCharacter = LEFT(wszPadCharacter, 1)
DIM cws AS CWSTR = SPACE(nStringLength)
IF wszPadCharacter <> "" THEN
FOR i AS LONG = 1 TO LEN(cws)
MID(**cws, i, 1) = wszPadCharacter
NEXT
END IF
MID(**cws, (nStringLength - LEN(wszMainStr)) \ 2 + 1, LEN(wszMainStr)) = wszMainStr
RETURN cws
END FUNCTION
' ========================================================================================