I'm trying to make a integer to string and also string to integer. Integer to string is what I want because if I finish integer to string I think I can reverse it.
Here is I have a wrong output. I likely created a number system in string like how you make a binary or etc. in my code it like this.
(a To 9) After
(b(a to 9) to 9(a to 9) After
(b(a(a to 9) to 9(a to 9)) To 9(a(a to 9) to 9(a to 9))
After First Set Of Characters The First Character Will Become (1 or b) like a number
0 to 9
1(0 to 9)
0 1 2 3 4 5 6 7 8 9 10 .... 99 100 ' it will not get 00 or 000 thats how like my code is.
Code I Come Up:
Private Function Integer_To_String(ByVal Number As Integer, ByVal Chars As List(Of String)) As String
Dim Character_String As New List(Of Integer)
Dim Character_Count As Integer = Chars.Count
Dim Left As Integer = Number
Dim Str As String = ""
While True
Character_String.Add(Left Mod Character_Count)
Left -= (Left Mod Character_Count)
If Not Left = 0 Then
Left /= Character_Count
Else
Exit While
End If
End While
For i = 0 To Character_String.Count - 1
Str &= Chars(Character_String.Item(Character_String.Count - 1 - i))
Next
Return Str
End Function
Public Function LoadCharacters(ByVal Letters As Boolean, ByVal Numbers As Boolean, ByVal Symbols As Boolean) As List(Of String)
Dim L As New List(Of String)
If Symbols = True Then
For i = 3 To 8
L.Add(Chr(i).ToString)
Next
For i = 11 To 27
L.Add(Chr(i).ToString)
Next
For i = 33 To 47
L.Add(Chr(i).ToString)
Next
For i = 58 To 64
L.Add(Chr(i).ToString)
Next
For i = 91 To 96
L.Add(Chr(i).ToString)
Next
For i = 123 To 126
L.Add(Chr(i).ToString)
Next
For i = 130 To 140
L.Add(Chr(i).ToString)
Next
For i = 145 To 156
L.Add(Chr(i).ToString)
Next
For i = 158 To 159
L.Add(Chr(i).ToString)
Next
For i = 161 To 255
L.Add(Chr(i).ToString)
Next
End If
If Letters = True Then
For i = 65 To 90
L.Add(Chr(i).ToString.ToLower)
Next
For i = 65 To 90
L.Add(Chr(i).ToString.ToUpper)
Next
End If
If Numbers = True Then
For i = 0 To 9
L.Add(i)
Next
End If
Return L
End Function
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Characters = LoadCharacters(False,True,False)
End Sub
I want
0 to 9 After
0(0 to 9) to 9(0 to 9)
0(0(0 to 9) to 9(0 to 9)) to 9(0(0 to 9) to 9(0 to 9))