1

So I've got this code in Gambas 3 on Debian 8 to split a string into characters, when executed it says, that there

Eingabe and buchstaben are both declared as strings, while buchstaben is an array.

Public buchstaben As String[]
Public Eingabe As String



Eingabe = LCase(T1.Text)

For j = 0 To (Len(Eingabe) - 1)
  buchstaben.Add(Mid(Eingabe, i, 1))
  i += 1
Next

T1 is a Textbox, which takes strings.

alsternerd
  • 123
  • 7

1 Answers1

1

I got the Solution myself now. I need to add

buchstaben = New String[]

into the function, before I use the array for some reason.

alsternerd
  • 123
  • 7
  • 2
    without the new keyword, your string array won't get initialized, it will only be typed as a String[] but would be Nothing/False. Once you initialize the object, you can use it to Add new items. You could initialize it already during declaration by using `Public buchstaben as New String[]` – Icepickle Jul 24 '16 at 21:45