Tuesday, April 29, 2025

Append Incremental alphabets in end vb.net

 



 Public Function incrementChar(ByVal count As Integer) As String

'Dim count As Integer

      Dim MyLet As Integer, j As Integer = 0, i As Integer = 0

      Dim updatedDate As String = DateTime.Now().ToString("MM.dd.yy")

      Dim ChkNum As String = ""

      For i = 0 To count

          If i < 26 Then

              MyLet = 65

             ChkNum = "ACH " & updatedDate & " " & Char.ConvertFromUtf32(i + MyLet)

Else If i >= 26 And i < count Then

              MyLet = 65

              ChkNum = "ACH " & updatedDate & " " & Char.ConvertFromUtf32(j + MyLet) & Char.ConvertFromUtf32(j + MyLet)             

              j += 1

          End If

      Next

      Return ChkNum

  End Function







    Public Function incrementChar() As String

        Dim MyLet As Integer, j As Integer = 0, i As Integer = 0

        Dim updatedDate As String = DateTime.Now().ToString("MM.dd.yy")

        Dim ChkNum As String = ""

        For i = 0 To 36

            'Console.WriteLine("i: " & i.ToString())

            If i < 26 Then

                MyLet = 65

                ChkNum = "ACH " & updatedDate & " " & Chr(i + MyLet)

                Console.WriteLine(ChkNum)

            ElseIf i >= 26 And i < 36 Then

                MyLet = 65

                ChkNum = "ACH " & updatedDate & " " & Chr(j + MyLet) & Char.ConvertFromUtf32(j + MyLet)

                Console.WriteLine(ChkNum)

                j += 1

            End If

        Next

        Return ChkNum

    End Function

End Module

No comments:

Post a Comment