SUB FixStr(Str as String) Str=space(20-len(Str)) & Str) end sub调用: Msgbox FixStr("abc")
10位字符右对齐: Format$("abc","@@@@@@@@@@")
Private Sub Form_Load() MsgBox FixStr("abcd", 25) MsgBox Len(FixStr("abcd", 25)) End Sub Private Function FixStr(Str As String, L As Integer) FixStr = Space(L - Len(Str)) & Str End Function
SUB FixStr(Str as String)
Str=space(20-len(Str)) & Str)
end sub调用:
Msgbox FixStr("abc")
Format$("abc","@@@@@@@@@@")
MsgBox FixStr("abcd", 25)
MsgBox Len(FixStr("abcd", 25))
End Sub
Private Function FixStr(Str As String, L As Integer)
FixStr = Space(L - Len(Str)) & Str
End Function
Right(" " & str,20)