canalrun Well-Known Member Licensed User Longtime User Aug 12, 2011 #1 Hello, I think I have seen this somewhere before, but I cannot find it again and I cannot find this in a manual anywhere. Is it possible to use a string as the index for an array? For example: B4X: Dim MA(5) as Int MA("one") = 1 or something similar to that. Can I do something like: B4X: Dim MA(5) as Int Dim s as String s = "one" MA(s) = 1 More importantly. Is there a B4A manual which describes the language features and structure? Thanks, Barry.
Hello, I think I have seen this somewhere before, but I cannot find it again and I cannot find this in a manual anywhere. Is it possible to use a string as the index for an array? For example: B4X: Dim MA(5) as Int MA("one") = 1 or something similar to that. Can I do something like: B4X: Dim MA(5) as Int Dim s as String s = "one" MA(s) = 1 More importantly. Is there a B4A manual which describes the language features and structure? Thanks, Barry.
klaus Expert Licensed User Longtime User Aug 12, 2011 #2 No, you cannot use a string as the index. The index must be an Integer. You can have: B4X: Dim MA(5) As Int MA(1) = 1 or B4X: Dim MA(5) As String MA(1) = "one" Have a look at the Beginner's Guide . Best regards. Upvote 0
No, you cannot use a string as the index. The index must be an Integer. You can have: B4X: Dim MA(5) As Int MA(1) = 1 or B4X: Dim MA(5) As String MA(1) = "one" Have a look at the Beginner's Guide . Best regards.
canalrun Well-Known Member Licensed User Longtime User Aug 12, 2011 #3 Thanks. The beginners guide looks fantastic. Barry. Upvote 0
A admac231 Active Member Licensed User Longtime User Aug 12, 2011 #4 To answer your initial question, have a look at maps. Upvote 0
canalrun Well-Known Member Licensed User Longtime User Aug 12, 2011 #5 Maps may be the way to go! Thanks, Barry. Upvote 0