hi
i want to find a string in file then retrieve the rest,this is an
exemple of a line:
taske :say_hellow do
i want retrieve just “say_hellow”
so how can i do please.
thanks.
Should be able to do something like to separate the tasks:
u = open( “myfile” )
while line = u.gets
if line.include?( “taske :” )
anArray = line.split(’ ')
puts anArray[1] if anArray.length > 0
end
end
You could even combine the split function with the index function
line,split(’ ')[1] if you are sure where the target info will be.
Note: Don’t be afraid to try different things. This solution is only
one of many and others here could do a lot better. You could do better
with a little practice and research.
Read class String - RDoc Documentation
After you finish reading that, if you still have questions give a holler
over at the Ruby - Ruby-Forum (ruby) forum. This is
more of a ruby question than it is a rails question, unless you can be
more specific as to what type of task within rails you are trying to
create.
Take care.