我有包含产品信息的字符串,我想解析该字符串并读取产品信息。
我的字符串如下所示:
ID: 1
NAME: Product name
INFORMATION: Here goes the information about a product
STATUS: Available
我想以这种方式解析此文本:
string id = product id;
string name = product name;
string info = product information;
string available = product availability;
我怎样才能做到这一点。我知道团体是可能的,但我被困住了,不知道怎么做。
提前致谢。