c# - 对于应该具有If条件的数组的for循环c#
问题描述
我必须使用 for 循环迭代一个数组以找到其中包含特定单词并将其添加到列表框 String[] result= ["vicky","vinay@","google@","hello"]
For (l=0 ; l<= result.length; l++)
{
If(result[l].contains("@")
{
Listbox.items.add(result[l]);
}
}
这是做什么的,它只获得第一个发现的价值,我没有获得第二个价值?
解决方案
您的数据需要一个排序列。让我假设你有一个。
首先添加新列:
alter table t add column id int;
注意: 对于可以id
是. 然后:null
with toupdate as (
select t.*,
row_number() over (partition by col1 order by <ordering col>) as seqnum
from t
)
update toupdate
set id = (case when col1 = 1 then seqnum end);
严格来说,你不需要在 时更新值col1 = 0
,因为默认值为NULL
。但是,如果你想要一个不同的值,我会省略where col1 = 1
.
推荐阅读
- kubernetes - 如何更改 VolumeMount 的用户和组所有者
- javascript - 计算器运算符和函数不起作用
- azure-application-insights - 如何使用 Azure Application Insights 在 Node.js (ws) 中跟踪 WebSocket?
- javascript - 如何使用 unpkg 作为 MDC CSS 文件和 s 文件的存储在 Web 应用程序上添加 Material Design 选项卡
- jmeter - Beanshell 函数在 if/else 评估之前被调用
- sql - 差距和岛屿 - POSTGRESQL
- java - Kafka Stream Chained LeftJoin - 在新消息之后再次处理之前的旧消息
- regex - 使用 sed 提取 git diff 的插入和删除数量
- javascript - 用户界面在切换点击时没有反映正确的类
- javascript - Fetch API - 将 html 文件存储在变量中,然后查询变量内容