2011-07-01 163 views
1

ProfilePageList是字符串数组,每个字符串都包含pageID,PageName和PageContent,由字符组(#$%)分隔。这是一个用C#中的ASP.NET应用程序子字符串数组索引问题

  foreach (string item in ProfilePageList) 
      { 
       string PageContent = ""; string PageName = ""; string PageID = ""; 

       *** > This part is wrong. Help me here *** 

       PageID = item.Substring(0, item.IndexOf('#$%') + 2); 
       PageContent = item.Substring(item.IndexOf('#$%') + 1); 
       PageName = item.Substring(0, item.IndexOf('#$%')); 


       callsomefunction(PageID , PageName, PageContent); 
      } 

输入的字符串Helloo#$%<p>How are you??</p>#$%74396

我不知道如何使用这个字符串。有人能帮助我吗!!非常感谢提前..

+0

提供输入字符串。 –

+0

你应该更喜欢使用string.Empty over“” –

+0

@Remo:你为什么使用#$%作为分隔符@ Muad'Dib:它没有实际的区别。事实上,我认为完全没有区别,至少在.NET的新版本中是这样。 –

回答