English 中文(简体)
我如何从一个或一个â开始找到所有物品?
原标题:How can I find all items beginning with a or â?

我有一份按其第一封信分类的项目清单。 用户在一封信中点击,从那封信开始便拿到所有条目。

这一点并不会奏效。 如果我选择这封信件,则没有归还有â的物品。

无论物品是否具有礼节性,返还物品有什么好办法?

                 <%  char alphaStart = Char.Parse("A"); 
                        char alphaEnd = Char.Parse("Z"); %>
                    <%  for (char i = alphaStart; i <= alphaEnd; i++) { %>
                        <% char c = i; %>
                        <% var abcList = Model.FaqList.Where(x => x.CmsHeader.StartsWith(c.ToString())).ToList(); %>
                        <% if (abcList.Count > 0 ) { %> 
                            <div class="naviPkt">
                                <a id="<%= i.ToString().ToUpper() %>" class="naviPktLetter" href="#<%= i.ToString().ToLower() %>"><%= i.ToString().ToUpper() %></a>
                            </div>
                            <ul id="menuGroup<%= i.ToString().ToUpper() %>" class="contextMenu" style="display:none;">
                                <% foreach (var info in abcList) { %>
                                    <li class="<%= info.CmsHeader%>">
                                        <a id="infoId<%= info.CmsInfoId%>" href="#<%= info.CmsInfoId%>" class="abcEntry"><%= info.CmsHeader%></a>
                                    </li>
                                <% } %>                                        
                            </ul>
                        <% } %>

                    <% } %>
最佳回答
问题回答

Try using i.ToString().ToUpper (StringComparison.InvariantCultureIgnoreCase). 它使用一种文化中立模式进行个案转换,消除吸收剂。

除了LBushkin的回答(我认为他会工作)外,你还可以清理你的字母代号。

var A = Char.Parse("A");
var alphabet = Enumerable.Range(0, 26).Select(i => A + i);

然后,你可以使用一种 for子,并忘记整个<代码>c = i。 另外,你不需要<代码>。





相关问题
How does gettext handle dynamic content?

In php (or maybe gettext in general), what does gettext do when it sees a variable to dynamic content? I have 2 cases in mind. 1) Let s say I have <?=$user1?> poked John <?=$user2?>. ...

Explain the Need for Mutexes in Locales, Please

Reading the question Why doesn’t C++ STL support atoi(const string& ) like functions?, I encountered a comment which warned that GCC (at least) has a bug that can slow down multi-threaded ...

How does Vistalizer work

How does Vistalizer manage to override the language limit in Windows Vista Home edition. Which api s does it use to allow installation of Multiple language packages.

Localized exceptions (within a Struts2 app)

I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no ...

Rails Globalize plugin help

Has anyone gotten the Globalize plugin to work Rails 2.3.2 or later? If so, could you direct me to some useful info?