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.

0

1 Answer 1

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.

1
  • 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, 2016 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.