Hello,
I'm new to RealBasic and you might read me again in the near future.My
first problem comes from a function defined in a module.
The function receives a string as a parameter.
This string is actually a text. I want the function to separate its
different words and store them in an array. I have no problem getting
this to work. But I want this array to be the form of a n x 3
spreadsheet. The second and third "columns" shall have the position of
the first and last characters of the word stored in the first column.
But when I define the array with this extra dimension and fill it with
the additional values (as strings), the application will just not
compile. I get this weird warning :
Type mismatch error. Expected String(), but got String(,). (See ? There
is a coma between the brackets.)
The array is defined as an array of strings, and the numbers I put in
are translated with the str() function.
So, does that mean that it is just impossible to use a
multidimensionnal array as a function result ? And, by the way, is it
not possible to use arrays of arrays in RealBasic ?
If so, do you see any workaround to get several variables back from one
passed ?
I hope I've been clear enough. If needed, the code is below.
Thanks,
Octave
Code :
(The important stuff is near the end. The array that needs to be sent
back is called aListeMots)
Function modListeMots(s as string) As string()
nbChar=s.len()
dim separateurs as string
dim rc as string
rc=EndOfLine.Macintosh
separateurs=",.! ?'¡¿:;<>()"+rc
dim i,j,c1,cd,n,nlleLigne as integer
dim vChar,vChar2 as string
dim aListeMots (-1,2) as string
i=1
c1=0
cd=0
do until i>nbChar
vChar = mid(s,i,1)
if inStr(separateurs, vChar)=0 then
c1=i
j=i+1
vChar2 = mid(s,j,1)
do until j>nbChar or inStr(separateurs,vChar2)>0
j=j+1
vChar2 = mid(s,j,1)
loop
cd=j-1
nlleLigne=ubound(aListeMots)+1
redim aListeMots(nlleLigne,2)
aListeMots(nlleLigne,0)= mid(s,c1,(cd-c1+1))
aListeMots(nlleLigne,1) = str(c1)
aListeMots(nlleLigne,2) = str(cd)
i=j
else
i=i+1
end if
loop
return aListeMots
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>