String manipulation(NEWBIE!)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StepIre
    New Member
    • Mar 2008
    • 1

    String manipulation(NEWBIE!)

    Hey Guys,

    Sorry if this is silly question but i am new to all of this!

    Basically i have a file that has some content in it that i want to get out.

    i want to find say an occurence of the string "blah".

    then i want to find the next occurence of the string "blah2" after that.

    and then i want to use the information between the 2 strings i have found??

    Does anybody have any information i could use on something like this?

    Thanks!!
  • jlm699
    Contributor
    • Jul 2007
    • 314

    #2
    I think your best bet would be to read() the file's contents into a string variable and then search through that using the find() method, which returns an index.

    From that point it's a simple matter of using slicing [x : y] on the string.

    Hope that helps...

    Comment

    Working...