auto-großschreiben


SUBMITTED BY: Guest

DATE: Jan. 2, 2014, 12:45 p.m.

FORMAT: Text only

SIZE: 1.1 kB

HITS: 1593

  1. Public Function AutoUpper(input As String) As String
  2. Dim returns As New List(Of Char)
  3. returns = input.ToCharArray.ToList
  4. For l As Integer = 0 To returns.Count - 1
  5. If Not (Char.IsWhiteSpace(returns(l))) Then
  6. returns(l) = CType(returns(l).ToString.ToUpper, Char)
  7. Exit For
  8. End If
  9. Next
  10. For i As Integer = 0 To returns.Count - 1
  11. If Not i = returns.Count - 1 Then
  12. If (returns(i) = ".") Then
  13. If input(i + 1) = " " Then
  14. returns(i + 2) = CChar(returns(i + 2).ToString.ToUpper)
  15. Else
  16. returns(i + 1) = CChar(returns(i + 1).ToString.ToUpper)
  17. End If
  18. End If
  19. End If
  20. Next
  21. Dim sb As New StringBuilder
  22. For Each c In returns
  23. sb.Append(c)
  24. Next
  25. Return sb.ToString
  26. End Function

comments powered by Disqus