Steffen Grund wrote:
> Hello,
>
> I am not the Basic expert here, but wouldn't something like this work?
>
> While Position <> <exit_value>
> Position = Instr(i, ProcessString, " ")
> etc. etc. etc.
> Wend
>
> and just initialize Position before, so it does not have the exit value?
>
>
Hi Steffen,
In fact, no it wouldn't. I'm processing entries in a spreadsheet which may
have an arbitrary number of spaces in them. The entries also contain
numbers. The idea is that all the numbers within a given chunk have to wind
up at the end of the chunk next to a following space or EOL. So the exit
condition would be when there are no more spaces left in the entry. I do
this by successively shrinking the value of ProcessString with each loop.
The actual code I wrote looks like this:
Function cutspace(ProcessString) as String
Dim i As Integer
Dim Position As Integer
Dim Chunk As String
Dim Res As String
Dim Lft As String
While Instr(ProcessString, " ")
Position = Instr(ProcessString, " ")
Chunk = mid(ProcessString, 1, Position - 1) 'chunk up to space
Res = mid(ProcessString, Position + 1, 999) 'from after space
to end
Lft = Lft + movetones(Chunk) + " "
ProcessString = Res
Wend
ProcessString = Lft + movetones(Res)
cutspace=ProcessString
end Function
Pretty ugly, eh?
Cheers,
Jonathan
--
Registerd Linux user #445917 at http://counter.li.org/
Please do not send me copies of list mail. I read the lists. Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]