Page 1 of 1

Evaluate these scripts please..

Posted: 2005-02-08 17:57:37
by pim
Hey there..
I would like you to evaluate these scripts and tell me if they are really ok :D!


This one is about separating string such as "abc cdf aaa"
The output would be :
sArray[0] = Count of separated strings (3 on the sample)
sArray[1] = abc
sArray[2] = cdf
sArray[3] = aaa

Code: Select all

Sub SeparateString(string,sArray)

var LastAdd = 1
var tempString = ""
var i
for i = 0 to Len(string)

   If not string[i] == " " then
      tempString = tempString + string[i]
   End if
   If string[i] == " " or Len(string) == i then
      If not tempString == "" then
         sArray[LastAdd] = tempString
         tempString = ""
         LastAdd = LastAdd + 1
      End if
   End if
   
next
sArray[0] = LastAdd - 1
return sArray
End sub



Ok, this next one is about finding a substring on a fullstring..
I haven't found any injection function for that, and then i decided to do it myself..
Example: InString("what","ha"), InString("staff","af")
It returns 1 because it's found there..

Code: Select all

Sub InString(string,what)

var i
var ii
var i2 = 0
var tempString = ""
var tMax = Len(string)
tempString = ""   
For i = 0 to max
   For ii = i to max
      
      While ii