leosco

leosco

  • NA
  • 13
  • 0

Help obtaining a string in a textbox

Sep 19 2010 12:11 AM

Hi.
For my project, I need to get all strings in a textbox which start with ! (define). For example:

!something = $10
!somethingelse = $14

Now my idea was to save the file every time the text is changed (might be slow though..) and read each line one by one in that file and use the IndexOf method to check if the lines contains a '!'. If it does then it will store that define somewhere. The problem is this is that I get the whole line (!something = $10) when I just want the !something part.

Can someone tell me how I would do this? I thought of trimming all characters after a space (because each define has a space after it) but I don't know how to do that. Help would be appreciated.

Alternatively, if someone has a better way of doing this, then please let me know.


Thanks in advance.

Answers (3)