udfGetTextProperties
arr udfGetTextProperties (str)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfGetTextProperties (strText)
If strText == "" Then Return Arrayize (0 : @LF : 0, @LF) ; Return dim-1 array of two elements: [0]=0, [1]=0.
intCharCountMax = 0
strText = StrReplace (strText, @CRLF, @LF)
arrText = Arrayize (strText, @LF)
intItems = ArrInfo (arrText, 1)
intLast = intItems - 1
For intI = 0 To intlast
   intCharCountMax = Max (intCharCountMax, StrCharCount (arrText[intI]))
Next
Return Arrayize (intItems : @LF : intCharCountMax, @LF)
#EndFunction
;..........................................................................................................................................
; This UDF "udfGetTextProperties" evaluates a text string having one or more lines ...
; and returns a dim-1 array of two elements: [0]=Line count, [1]=Longest line char count.
;
; (c)Detlev Dalitz.20120425.
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

DirChange (DirScript ())
strFileThis = IntControl (1004, 0, 0, 0, 0) ; Use this script file as test input.

strText = FileGet (strFileThis)
arrProp = udfGetTextProperties (strText)

strMsgTitle = "Test | udfGetTextProperties"
strMsgText = "File = " : strFileThis : @LF : @LF : "Line Count = " : arrProp[0] : @LF : "Longest Line Char Count =" : arrProp[1]
Pause (strMsgTitle, strMsgText)

:CANCEL
Exit