(PowerBuilder) Get the Last N Lines of a StringBuilder
Returns up to the last N lines of the contents of a Chilkat StringBuilder.
integer li_rc
oleobject loo_Sb
integer i
integer li_BCrlf
loo_Sb = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_Sb.ConnectToNewObject("Chilkat.StringBuilder")
if li_rc < 0 then
destroy loo_Sb
MessageBox("Error","Connecting to COM object failed")
return
end if
i = 1
do while i < 100
loo_Sb.Append("This is line number ")
loo_Sb.AppendInt(i)
loo_Sb.Append("~r~n")
i = i + 1
loop
li_BCrlf = 1
Write-Debug loo_Sb.LastNLines(12,li_BCrlf)
// Output is:
//
// This is line number 88
// This is line number 89
// This is line number 90
// This is line number 91
// This is line number 92
// This is line number 93
// This is line number 94
// This is line number 95
// This is line number 96
// This is line number 97
// This is line number 98
// This is line number 99
//
destroy loo_Sb
|