MS Module Base StringFunctions
Modules.Jibs Sichtbeleg Anpassung
This commit is contained in:
22
Base/StringFunctions.vb
Normal file
22
Base/StringFunctions.vb
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user