0

I have a question I want to store all the characters after "-" sign to my cookies using c# and asp.net. Example: rock star-games so here I want to store "games" word in cookies as it is after - sign so is it possible or is there any other solution using SQL Server etc. I have searched for many days but could not find any solution for storing some part of word in cookies.

4

1 回答 1

2

要分隔字符串,您可以这样做

  string[] split = mystring.Split('-');
  string afterthedash = split[1];

您还想确认字符串中是否有破折号,如果string[]超过 2 个项目,请将附加项组合起来,但它们应该只有两个,等等。

但以上是如何做到这一点的基础知识。

然后继续将它们存储在 cookie/mssql/etc. 中,这是一个完全不同的问题,如果您能准确说明是什么部分阻碍了您,这将有所帮助。

于 2013-06-24T03:18:00.763 回答