For what its worth, I also use a custom made trim, as follows (also employs / also you can use) left / right functions ...
Quote:
Sub Left(left_mystr,left_length)
If left_mystr = "" Then Return
Return SubString (left_mystr,0, left_length)
End Sub
Sub Right(right_mystr,right_length)
If right_mystr = "" Then Return
Return SubString (right_mystr, StrLength (right_mystr) - right_length, right_length)
End Sub
Sub Trim(trim_str)
Do Until StrCompare(Left(trim_str,1)," ") <> 0
trim_str = SubString(trim_str,1,StrLength(trim_str)-1)
Loop
Do Until StrCompare(right(trim_str,1), " ") <> 0
trim_str = left(trim_str,StrLength(trim_str)-1)
Loop
Return trim_str
End Sub
|
I must admit though, processing time is an issue ... I load in a 16k Scott adams data format file (contains saved integers and strings) and, in the compiled version of my game it takes about :
app compiled for and running on PC 0.5 - 1 second
app compiled on and running on ppc (rw6815) 10 seconds
... to load the data file into variables ...
Perhaps indeed the compiler can be tuned for better string manipulation?
I am now in the process of removing my trim / left / right functions (mid already removed) in place of the native str functions of b4p to see if this helps any as my original functions were used to a) help me converting my app from vb (convenient at the time and b) learning to use the foreign (to me) strindexof / substring etc ...