gpt4 book ai didi

c# - 如何使用 linq 和 string.EndsWith(<1 of N items in an array>)

转载 作者:行者123 更新时间:2023-11-30 14:30:57 25 4
gpt4 key购买 nike

我在标题中有如上的表达。是否可以使用 linq 遍历数组并评估是否为真。例子string[] a = {"es","ag"}

if (string.EndsWith(<1 of N items in a>)==true){//do something}

最佳答案

if (a.Any(yourString.EndsWith))
{
//your string ends with one of those endings.
}

关于c# - 如何使用 linq 和 string.EndsWith(<1 of N items in an array>),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21571198/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com