Two functions in the display format (automatic wrap, automatic omit)

zhaozj2021-02-16  53

1) Function: rowscode () ----- Show n letters per line, automatic wrap

Function RowsCode (STR, N) IF LEN (STR) <= n / 2 ThenRowscode = strelsedim TSTRDIM L, T, CDIM IL = LEN (STR) TSTR = "" T = 0for i = 1 to lc = ASC (MID (STR , I, 1)) IF C <0 THEN C = C 65536IF C> 255 THENT = T 2ELSET = T 1END IFTSTSTSTR = TSTR & (MID (STR, I, 1)) IF T> N THEN TSTR = TSTR & "
"T = 0nd ifnextrowscode = TSTREND IFEND FUNCTION

2) Function: lefttrue () ----- If the length of the string STR is greater than n, the N characters on the left are displayed.

Function Lefttrue (STR) <= N / 2 THEFTTRUE = strelsedim TSTRDIM L, T, CDIM IL = LEN (STR) TSTR = "" T = 0for i = 1 to lc = ASC (MID (STR , i, 1)) IF C <0 THEN C = C 65536IF C> 255 THENT = T 2ELSET = T 1END IFIF T> N THEN EXIT FORTSTR = TSTR & (MID (STR, I, 1)) NextLTLTRUE = TSTR & "..." end ifend function

转载请注明原文地址:https://www.9cbs.com/read-22733.html

New Post(0)