Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print Using?
#38
Well I practiced making a generalized Function Pad$ because of this thread but not very useful towards specific problem of OP but WTH?
Code: (Select All)
_Title "Test Pad$" ' b+ 2022-11-02
Print "When fill space > string"
s$ = "Test Pad"
Print "*" + Pad$(" ", 20, s$, "l") + "*"
Print "*" + Pad$(" ", 20, s$, "c") + "*"
Print "*" + Pad$(" ", 20, s$, "r") + "*"
Print
Print: Print "When fill space < string"
Print "*" + Pad$(" ", 6, s$, "l") + "*"
Print "*" + Pad$(" ", 6, s$, "c") + "*"
Print "*" + Pad$(" ", 6, s$, "r") + "*"
Print: Print "When fill space = string"
Print "*" + Pad$(" ", 8, s$, "l") + "*"
Print "*" + Pad$(" ", 8, s$, "c") + "*"
Print "*" + Pad$(" ", 8, s$, "r") + "*"
Print: Print "zzz... press key to test Time$ format"
Sleep
' time format
While m < 60 And _KeyDown(27) = 0
    Cls
    Locate 2, 1: Print Pad$("_", 80, "Press escape to quit time format demo", "C")
    s = s + 1
    If s > 59 Then m = m + 1: s = 0
    If m > 59 Then h = h + 1: m = 0
    H$ = _Trim$(Str$(h)): M$ = _Trim$(Str$(m)): s$ = _Trim$(Str$(s))
    Print Pad$("0", 2, H$, "r") + ":"; Pad$("0", 2, M$, "r") + ":" + Pad$("0", 2, s$, "r")
    _Limit 1000
Wend
Locate 20, 1: Print Pad$(".", 80, "End of Pad$ Demo", "C")

Function Pad$ (FillChar$, nFill As Long, s$, Align$) ' fill char, width of whole string, string to align, align: L, C, R
    Dim blank$
    blank$ = String$(nFill, FillChar$)
    Select Case UCase$(Align$)
        Case "L": Mid$(blank$, 1) = s$
        Case "C": Mid$(blank$, (nFill - Len(s$)) \ 2 + 1) = s$
        Case "R"
            If nFill >= Len(s$) Then
                Mid$(blank$, nFill - Len(s$) + 1) = s$
            Else
                blank$ = Mid$(s$, Len(s$) - nFill + 1, nFill)
            End If
    End Select
    Pad$ = blank$
End Function
b = b + ...
Reply


Messages In This Thread
Print Using? - by james2464 - 11-01-2022, 11:39 PM
RE: Print Using? - by bplus - 11-01-2022, 11:45 PM
RE: Print Using? - by mnrvovrfc - 11-01-2022, 11:49 PM
RE: Print Using? - by Pete - 11-01-2022, 11:51 PM
RE: Print Using? - by james2464 - 11-02-2022, 12:03 AM
RE: Print Using? - by Kernelpanic - 11-02-2022, 12:23 AM
RE: Print Using? - by PhilOfPerth - 11-02-2022, 12:26 AM
RE: Print Using? - by justsomeguy - 11-02-2022, 12:36 AM
RE: Print Using? - by james2464 - 11-02-2022, 12:54 AM
RE: Print Using? - by Kernelpanic - 11-02-2022, 01:03 AM
RE: Print Using? - by PhilOfPerth - 11-02-2022, 01:33 AM
RE: Print Using? - by justsomeguy - 11-02-2022, 01:55 AM
RE: Print Using? - by SMcNeill - 11-02-2022, 02:51 PM
RE: Print Using? - by james2464 - 11-02-2022, 03:37 PM
RE: Print Using? - by mdijkens - 11-02-2022, 06:04 PM
RE: Print Using? - by bplus - 11-02-2022, 06:16 PM
RE: Print Using? - by james2464 - 11-02-2022, 06:22 PM
RE: Print Using? - by bplus - 11-02-2022, 06:25 PM
RE: Print Using? - by james2464 - 11-02-2022, 06:33 PM
RE: Print Using? - by Pete - 11-02-2022, 06:33 PM
RE: Print Using? - by james2464 - 11-02-2022, 06:43 PM
RE: Print Using? - by mnrvovrfc - 11-02-2022, 06:48 PM
RE: Print Using? - by Pete - 11-02-2022, 06:54 PM
RE: Print Using? - by TerryRitchie - 11-02-2022, 09:22 PM
RE: Print Using? - by james2464 - 11-02-2022, 06:51 PM
RE: Print Using? - by Kernelpanic - 11-02-2022, 10:36 PM
RE: Print Using? - by SMcNeill - 11-03-2022, 12:11 AM
RE: Print Using? - by Kernelpanic - 11-03-2022, 12:47 AM
RE: Print Using? - by mnrvovrfc - 11-03-2022, 12:07 PM
RE: Print Using? - by Kernelpanic - 11-03-2022, 03:26 PM
RE: Print Using? - by SpriggsySpriggs - 11-03-2022, 03:44 PM
RE: Print Using? - by bplus - 11-03-2022, 03:53 PM
RE: Print Using? - by Kernelpanic - 11-03-2022, 03:59 PM
RE: Print Using? - by SpriggsySpriggs - 11-03-2022, 04:36 PM
RE: Print Using? - by mnrvovrfc - 11-03-2022, 05:17 PM
RE: Print Using? - by SpriggsySpriggs - 11-03-2022, 05:59 PM
RE: Print Using? - by mnrvovrfc - 11-03-2022, 09:16 PM
RE: Print Using? - by bplus - 11-03-2022, 05:22 PM
RE: Print Using? - by mnrvovrfc - 11-03-2022, 05:32 PM
RE: Print Using? - by bplus - 11-03-2022, 05:57 PM
RE: Print Using? - by SMcNeill - 11-03-2022, 05:58 PM
RE: Print Using? - by Kernelpanic - 11-04-2022, 12:57 AM
RE: Print Using? - by mnrvovrfc - 11-04-2022, 03:47 PM



Users browsing this thread: 2 Guest(s)