Problem with oStream.Find?

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by Karl Grambow
SyntaxEditor v3.1.203, .NET 1.1, Win XP.


I'm using oStream.Find to go through a document until a particular token cannot be found and I'm finding it fails to work in a specific instance.

I'm doing something like this:

While oStream.Find("SomeToken", True)

'do some stuff

End While
Now, interestingly, if the position of oStream is such that it sits immediately before "SomeToken" the oStream.Find returns false. In my case the token prior to "SomeToken" is a "LineTerminatorToken" but I don't know if that makes a difference. Let me know if you need any more details.

On another note, is there a method that would enable me to just pick out all of the Token's of a given key?

Something like: oStream.GetNextToken("SomeToken")?



Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Karl,

The Find method will move past the current token and examine the next token. So based on what you said, if you are already sitting on a target token, it will not examine that token since it's looking at the next one and the ones after that. Make sense?

We don't have anything built in that retrieves all the tokens of a given key. You could probably write a simple method with a loop to do that by using the Find method. Just be sure you examine the first token you are on before calling Find due to how Find works.

Actipro Software Support

Posted 18 years ago by Karl Grambow

That explains it. I'll just change the While loop to evaluate whether oStream.Find = true or oToken.Key="SomeToken" and that should take care of situations where I'm already sitting on the target token.

Thanks again,

The latest build of this product (v24.1.0) was released 5 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.