Basic Array Tutorial

bazp

Member
Licensed User
Longtime User
Basic Array Tutorial Question

I am having a hard time using arrays.

I need to do such basic tasks as converting a text field 10 characters long to 10 one character array fields.

I also want to lookup an array using a search word and getting back an index. I know you must have such a tutorial but I can't find it.

I have been using substring functions but it is very ineficient.
 
Last edited:

bazp

Member
Licensed User
Longtime User
Bad array samples

It would be nice to have the correct array equivilents. These work but take took much code and are not efficient.


Load 10 character field to ten 1 character array elements
-------------------------------------------------------
dim x as int
dim y as int


For x= 0 To 9
y=x+1
let(x)=word1.SubString2(x,y)
Next


A silly example of an array look up and update (lookup "a" make it "?"
----------------------------------------------------------------
For x=0 To 48

if let(x)="a" Then
let(r)="?"
End If

Next
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
I need to do such basic tasks as converting a text field 10 characters long to 10 one character array fields.

Can you use ToChars, or failing that use StringToBytes then CharsFromBytes?

Have a look at this Library
 
Last edited:
Upvote 0
Top