ok, I timed it pretty roughly in my head... it converts str0 (length: 77) into [A](7,11) in roughly 4 seconds... As an added bonus it will work with any symbols you use. Here is the code: (just the str0 to [A])
Code:
"ABCDEFGHIJKLMNOPQRSTUV..."->Str9
{7,11}->dim([A]
For(Z,1,7
For([i]e[/i],1,11
inString(Str9,sub(str0,(Z-1)11+[i]e[/i],1) -> [A](Z,[i]e[/i]
End
End
Although it is pretty easy to understand (in my opinion) I'll explain it:
"ABC..."-> Str9: These are the symbols in your string that will represent numbers. A=1, B=2... and so on. You can add more or get rid of them if you need to.
{7,11}->dim([A]: This just sets up the right dimensions of [A], just in case.
For(Z,1,7, For(
e[i],1,11: We neeed to loop 7 rows, 11, columns.
inString... The meat and potatoes of it. Here we go...
inString(Str9,sub(str0,(Z-1)11+[i]e,1) -> [A](Z,
e
Look in string 9 for the character
in string 0 at
this forumula... then save which place it is to [A], at the current loop coordinates.
thus if the current char. in str0 is 'B', it looks it up in str9, which just happens to be the second char. It stores that place (2) into the current coords in the matrix.
END:END: End our loops...
hope you like. please provide optimizations.[/i]