Steve,
Right,
Firstly:
Use a fetch statement to take the contents of a column
cell and place it into a array variable.
e.g.
For Var_A = 1 to TableInfo(tablename, TAB_INFO_NROWS)
Fetch Rec(Var_A) From table
arrayvariable(Var_A) = tablename.col(?)
Next
Once that is done:
CharacterCount = 0
Count = 1
For Var_B = 1 to Ubound(Arrayvariable)
if (checkletter = mid$(arrayvariable(var_B),
var_b, count) <> " "
Then charactercount = charactercount + 1
note("arrayvariable(var_B) has "+charactercount+"
non-spaced characters")
end if
you want to use mid$ to go through EACH character of a
string and check whether it's a " " - if not, add a 1
to a counter, if it is a " " then exit the loop and
print out the size of count (therefore you have the
number of characters that DO NOT = " ")
it's a simplified example above...I have code to
remove "_"'s from a string--...u can adapt it to suit
your needs and it'll show you how to go through a
string and check for "_"'s ; remove them and rebuild
the string...
***********************************************
i have included the code below...
Include "MapBasic.Def"
Declare Sub Main
Sub Main
Dim OldString, DummyString, SingleString(0),
NewString, Dummy, Dummy2 As String
Dim Var_A, Var_b, Count As Integer
Count = 1
OldString = "This_is_a_Test_String"
Note(OldString)
For Var_A = 1 to Len(OldString)
Redim SingleString(Var_A + 1)
DummyString = Mid$( OldString, Var_A, Count )
If DummyString <> "_" Then
SingleString(Var_A) = Mid$( OldString, Var_A, Count
)
Else SingleString(Var_A) = " "
End If
Next
For Var_B = 1 to Ubound(SingleString)
Dummy = Dummy + NewString
NewString = String$(1, SingleString(Var_B))
Dummy = Ltrim$(Dummy)
Next
Note(Dummy)
End Sub
this code is an example---you'll need to adapt it
slightly...
**********************************************
Ben Crane
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]