开发者

Pulling from a very very specific location imbedded in a text file

I finished every piece of code in my program save for one tid bit, how to pull two numbers from a text file. I know how to pull lines, I know how to pull search strings, but I cant figure out this one to save my life.

Anyways here is a sample of the automatically generated text that I need to pull from...

.......................................................................

Applications Memory Usage (kB): Uptime: 6089044 Realtime: 6089040

** MEMINFO in pid 764 [com.lookout] **

                native   dalvik    other    total
        size:    27908     8775      N/A    36683
   allocated:     3240     4216      N/A     7456
        free:    24115     4559      N/A    28674
       (Pss):     1454     1142     6524     *9120*
(priv dirty):     1436      628     5588     *7652*

Objects Views: 0 ViewRoots: 0 AppContexts: 0 Activities: 0 Assets: 3 AssetManagers: 3 Local Binders: 15 Proxy Binders: 41 Death Recipients: 3 OpenSSL Sockets: 0

SQL heap: 98 MEMORY_USED: 98 PAGECACHE_OVERFLOW: 16 开发者_JS百科 MALLOC_SIZE: 50

DATABASES pgsz dbsz Lookaside(b) Dbname 1 14 120 google_analytics.db

Asset Allocations zip:/system/app/com.lookout_6.0.1_r8234_Release.apk:/resources.arsc: 161K

.............................................................................

The two numbers that I need out of this are the two ones that I put in the **'s (the asterisks are not normally there). These numbers will be different every time this sheet is generated, and the number placement might be different as well as some of the numbers could have 4 digits, 5 digits, or 6 digits.

If anyone could shed any light on the subject it would be greatly appreciated

Thanks, Zach


You just need to read in the last word of the line and convert it to a number. Use String.LastIndexOf to find the last space " " in the file and read the data from that point forwards.

Dim line as String = "       (Pss):     1454     1142     6524     9120"
Dim value as Integer

If line.IndexOf("(Pss)") > 0 Then
    value = CInt(line.Substring(line.LastIndexOf(" ") + 1))
End If
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜