c# - 如何在 C# 中逐字迭代字符串?

标签 c#

我想逐字遍历字符串。

如果我有一个字符串“incidentno and fintype or unitno”,我想将每个单词一个一个地读为“incidentno”、“and”、“fintype”、“or”和“unitno”。

最佳答案

foreach (string word in "incidentno and fintype or unitno".Split(' ')) {
   ...
}

关于c# - 如何在 C# 中逐字迭代字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1442955/

相关文章:

c# - 如何在 C# 中使用 FileOpen (VB.NET)?

c# - 通过 P/Invoke 使用回调和堆对象的安全方法

c# - 如何计算其他国家的时间。在 C# 中使用我的本地机器时间?

c# - 检测 DEBUG、RELEASE 和我自己的模式 C#

c# - 在 WinForm C# 中获取最新的 xml (url)

c# - 转换为 IList 然后在 null 时调用 ToList() 是否比普通 ToList() 更好?

c# - Travis 无法找到 csharp 解决方案

c# - 从数据对象转换为业务对象。最佳实践

c# - Xml 文档未打包在类库中

c# - IDictionary 与哈希表 -