fb:porticula NoPaste
Dynamischer zeilenumbruch
Uploader: | XOR |
Datum/Zeit: | 23.06.2011 01:54:31 |
Function MackeBrakes ( ByVal Stri As String, ByVal Leng As Long, ByVal Br As String = Chr(13,10) ) As String
Dim Ret As String
Dim LL As String
Dim L As UInteger
Dim As Integer Last,fr
Do
Last = 0
For i As UInteger = 1 To Leng
Select Case Mid(Stri,i,1)
Case " "
Last = i
fr = 0
Case ""
Last = i
Exit For
Case "A" To "Z","A" To "Z","0" To "9","_"
If fr = 2 Then
last = i
EndIf
fr = 1
Case Else
If fr = 1 Then
last = i
EndIf
fr = 2
End Select
Next
If Last = 0 Then Last = Leng
LL = Mid(Stri,1,Last-1)
Stri = Mid(Stri,Last)
If Mid(Stri,1,1)=" " Then Stri = Mid(Stri,2)
If Stri <> "" Then
Ret += Mid(LL,1,Leng) + String(Leng-Last," ") + Br
Else
Ret += Mid(LL,1,Leng) + String(Leng-Last," ")
Return Ret
EndIf
Loop
End Function
Function MackeDynamicBrackes ( ByVal Stri As String, ByVal Leng As Long, ByVal Br As String = Chr(13,10) ) As String
Dim Posi As Integer
Dim Posialt As Integer
Dim Ret As String
Do
Posialt = Posi
Posi = InStr(Posi+1,Stri,Br)
If Posi = 0 Then
Posi += Len(Br)-1
Ret += MackeBrakes(Mid(Stri,Posialt+1),Leng,Br)
Return ret
Else
Posi += Len(Br)-1
Ret += MackeBrakes(Mid(Stri,Posialt+1,Posi-Posialt-Len(Br)),Leng,Br)+Br
EndIf
Loop
End Function
Dim k As String
Dim text As String
Print "Schriben Sie einen text"
Print "-----------------------"
Do
k = InKey
Select Case k
Case "A" To "Z","A" To "Z","0" To "9","_",".",","," "
text += k
Case Chr(13)
text += Chr(13,10)
Case Chr(8)
If Len(text) > 2 Then
If text[Len(text)-2] = 13 Then
text = Left(text,Len(text)-1)
EndIf
EndIf
text = Left(text,Len(text)-1)
Case Chr(255)+"k"
Exit Do
End Select
If k<>"" Then
Locate 3,1
Print MackeDynamicBrackes(text,24)+Chr(13,10)+String(24," ")
EndIf
Sleep 100
Loop Until MultiKey(1)