23 lines
858 B
VB.net
23 lines
858 B
VB.net
Public Class StringFunctions
|
|
Public Shared Function SplitText_Length(ByVal input As String, ByVal maxLength As Integer) As List(Of String)
|
|
Dim result As New List(Of String)
|
|
|
|
For i As Integer = 0 To input.Length - 1 Step maxLength
|
|
' Textabschnitt extrahieren
|
|
Dim chunk As String = input.Substring(i, Math.Min(maxLength, input.Length - i))
|
|
result.Add(chunk)
|
|
Next
|
|
|
|
Return result
|
|
End Function
|
|
Public Shared Function SplitTextByNewLine(text As String) As List(Of String)
|
|
If String.IsNullOrEmpty(text) Then
|
|
Return New List(Of String)()
|
|
End If
|
|
|
|
' Zerlege den Text anhand von Zeilenumbrüchen
|
|
Dim lines As List(Of String) = text.Split({vbCrLf, vbLf, vbCr}, StringSplitOptions.None).ToList()
|
|
Return lines
|
|
End Function
|
|
End Class
|