好了,所以我的代码看起来有点像这样某些字符选择字符,直到在C#中的某些字符
// Returns the note of a favorite pown if it exists
string GetFavoriteNote(int id)
{
string notelist = Properties.Settings.Default.FavoriteNotesList;
// If there's a note, return it
if (notelist.Contains("'" + id + ":"))
{
// What to do here?
}
// If there's no note, return an empty string
else
{
return String.Empty;
}
}
现在它基本上是一个系统,其中每个ID用户可以设置一个音符,它将被保存在这种格式:'id:note','id:note'
,
现在我要做的就是选择一个音符不知何故并返回,所以我不得不从"'" + id + ":"
喜欢选择直到“
如果有人知道如何做到这一点,请帮帮我。 感谢
您可以按','拆分,然后按':'拆分,然后您就可以得到笔记。或者你可以使用正则表达式。 – arunes 2012-03-08 09:16:40
你想要整个笔记结构(id = text)还是仅仅是笔记的文本部分? – 2012-03-08 09:29:47