我想要做的是分别读取文本文件的每一行,然后首先找到某个字符串,如果找到该字符串,则读取该行中的整数。
以下是字符串的外观:
{
"SmartCursorToggle": true,
"MapEnabled": true,
"InvasionBarMode": 2,
"AutoSave": true,
"AutoPause": false,
"Language": 1,
"PlacementPreview": true,
"GoreVisualsAllowed": true,
"VolumeSound": 1.0,
"VolumeAmbient": 0.75,
"VolumeMusic": 0.75,
"KeyUp": "W",
"KeyDown": "S",
"KeyLeft": "A",
"KeyRight": "D",
"KeyJump": "Space",
"KeyThrowItem": "T",
"KeyInventory": "Escape",
"KeyQuickHeal": "H",
"KeyQuickMana": "J",
"KeyQuickBuff": "B",
"KeyUseHook": "E",
"KeyAutoSelect": "LeftShift",
"KeySmartCursor": "LeftControl",
"KeyMount": "R",
"KeyMapStyle": "Tab",
"KeyFullscreenMap": "M",
"KeyMapZoomIn": "Add",
"KeyMapZoomOut": "Subtract",
"KeyMapAlphaUp": "PageUp",
"KeyMapAlphaDown": "PageDown",
"Fullscreen": false,
"WindowMaximized": false,
"DisplayWidth": 800,
"DisplayHeight": 704,
"GraphicsQuality": 0,
"BackgroundEnabled": true,
"FrameSkip": true,
"LightingMode": 0,
"LightingThreads": 0,
"MouseColorR": 252,
"MouseColorG": 233,
"MouseColorB": 221,
"Parallax": 90.0,
"ShowItemText": true,
"LastLaunchedVersion": 155,
"ClientUUID": "7d49a838-d7db-4e74-8124-92552a429491642949429491609524294916095159563f7c",
"UseSmartCursorForCommonBlocks": false,
"UseSmartAxeAfterSmartPickaxe": false,
"UseSmartWallReplacement": true,
"DisableLeftShiftTrashCan": false,
"HighlightNewItems": true,
"HidePasswords": false,
"ThickMouseEdges": true,
"ThickMouseEdgesPackedColor": 4289397106,
"ReverseUpDownForArmorSetBonuses": false,
"CloudSavingDefault": false
}
那些" {"括号位于文本文件中。
我想说我想找到鼠标颜色的R值,我会将每一行放入一个字符串数组中,看看索引(i)中的字符串是否包含" MouseColorR&#34 ;,我将如何获得该行中的整数?