how do i extract the last value of every output in c# ?

Posted by Prithvi on Stack Overflow See other posts from Stack Overflow or by Prithvi
Published on 2010-04-20T08:47:23Z Indexed on 2010/04/20 8:53 UTC
Read the original article Hit count: 172

Filed under:

Here is the contents of my text file which consists of a name like "output1" followed by a series of numbers, "output2" followed by a series of numbers and so on separated by a single space...I want to extract last value of every output. How do i do this? ie., I want to extract the value of "output1" as 29.933215(ie. the value just before "output2") and the values of "output2" as 379.983559

  • content of text file is as shown below:

output1 30.000000 29.999969 29.999907 29.999783 29.999535 29.999039 29.998047 29.996063 29.992133 29.988202 29.984273 29.980343 29.976414 29.972485 29.968556 29.964628 29.960700 29.956773 29.952846 29.948919 29.944992 29.941066 29.937140 29.933215 output2 380.000000 379.999990 379.999970 379.999930 379.999850 379.999691 379.999372 379.998734 379.997469 379.996204 379.994940 379.993675 379.992411 379.991146 379.989882 379.988617 379.987353 379.986088 379.984824 379.983559 output3 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761962 1.761962 1.761962 1.761962 1.761961 1.761961 1.761961 1.761960

© Stack Overflow or respective owner

Related posts about c#