【发布时间】:2013-12-18 00:33:28
【问题描述】:
我创建了包含一些文本的配置文件,并将此文件添加到 resource.resx。现在我为这个文本创建了字符串。
// String will be contains all texts from resource file
string TextFromResources = Resource.konfigurace;
TextFromResources -> 查看:
#################
# Settings
#################
RealmID = 1
#################
下一步我需要使用函数“IndexOf”。
int value = TextFromConfig.IndexOf("RealmID");
value = TextFromConfig.IndexOf('=');
value2 = TextFromConfig.IndexOf("/r/n");
RealmID = int.Parse(TextFromConfig.Substring(value, value2));
我需要该 realmID 返回 int 值“1”,但现在它什么也没返回。请问,你能帮我解决我的问题吗?
如果索引正确,那么它将返回值“1”,仅此而已。
【问题讨论】:
标签: c# text resources split indexof