Java 从大字符串中提取多个子字符串

Java 从大字符串中提取多个子字符串,java,string,substring,Java,String,Substring,我的输出文件如下所示 instance of Win32_Service { AcceptPause = FALSE; AcceptStop = TRUE; Caption = "Application Experience"; CheckPoint = 0; CreationClassName = "Win32_Service"; Description = "Processes application compatibility cache requests for applications

我的输出文件如下所示

instance of Win32_Service
{
AcceptPause = FALSE;
AcceptStop = TRUE;
Caption = "Application Experience";
CheckPoint = 0;
CreationClassName = "Win32_Service";
Description = "Processes application compatibility cache requests for applications as they are launched";
DesktopInteract = FALSE;
DisplayName = "Application Experience";
ErrorControl = "Normal";
ExitCode = 0;
Name = "AeLookupSvc";
PathName = "C:\\Windows\\system32\\svchost.exe -k netsvcs";
ProcessId = 1200;
ServiceSpecificExitCode = 0;
ServiceType = "Share Process";
Started = TRUE;
StartMode = "Auto";
StartName = "localSystem";
State = "Running";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "DHARMA-PC";
TagId = 0;
WaitHint = 0;
};

instance of Win32_Service
{
AcceptPause = FALSE;
AcceptStop = FALSE;
Caption = "Application Layer Gateway Service";
CheckPoint = 0;
CreationClassName = "Win32_Service";
Description = "Provides support for 3rd party protocol plug-ins for Internet Connection Sharing";
DesktopInteract = FALSE;
DisplayName = "Application Layer Gateway Service";
ErrorControl = "Normal";
ExitCode = 1077;
Name = "ALG";
PathName = "C:\\Windows\\System32\\alg.exe";
ProcessId = 0;
ServiceSpecificExitCode = 0;
ServiceType = "Own Process";
Started = FALSE;
StartMode = "Manual";
StartName = "NT AUTHORITY\\LocalService";
State = "Stopped";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "DHARMA-PC";
TagId = 0;
WaitHint = 0;
};

我想将Win32_服务的每个实例的RHS值存储在单独的变量中。我心里有一个解决办法,但我可以得到一个更有效的办法。对于每个实例的24个属性,我可以循环每个属性,找到IndexOf(“=”)和IndexOf(“;”)并获得它们之间的值。

产生此结果的代码在哪里?你真正的问题是什么?为什么不使用
Properties
类?这些是字符串的内容。我需要将RHS值存储在单独的变量中。