Re: TIB: Strings


[Prev][Next][Index][Thread]

Re: TIB: Strings




I have posted string functions on TICALC.ORG and they should
be there in a couple of days.  The functions will do something similar to 
what you want; they will break down a sentence into a list so you can extract 
individual words.

Here it is:

(x)
Func
Local  i,q,r,l,s,pl
If inString(x," ")=0 Then
{x}x
Goto  goodbye
EndIf
{" "}r
0l
For  i,3,dim(x),1
inString(x," ",i)q
qi
If q=0 Then
Goto  nxpr
EndIf
l+1l
qr[l]
EndFor
Lbl  nxpr
{}s
mid(x,1,r[1]-1)s[1]
For  i,1,dim(r)-1
mid(x,r[i],r[i+1]-r[i])s[1+i]
EndFor
mid(x,1+r[dim(r)])s[dim(s)+1]
{}pl
For  i,1,dim(s),1
If s[i]" " Then
s[i]pl[dim(pl)+1]
EndIf
EndFor
plx
Lbl  goodbye
xs
EndFunc

Other functions I have created will be to change to upper/lower case and 
remove spaces.


FUNCTIONS CREATED BY JOSEPH AT CALCUGLOBAL-HYPERMEGA-LINK