c# - 拆分字符串数组

标签 c# string split

我有一个字符串数组string[] arr,其中包含N36102W114383N36102W114382等值...
我想拆分每个字符串,使值像这样 N36082W115080

执行此操作的最佳方法是什么?

最佳答案

这应该适合你。

Regex regexObj = new Regex(@"\w\d+"); # matches a character followed by a sequence of digits
Match matchResults = regexObj.Match(subjectString);
while (matchResults.Success) {
    matchResults = matchResults.NextMatch(); #two mathches N36102 and W114383
}

关于c# - 拆分字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8047240/

相关文章:

c# - Windows 8 RT 应用程序控件多次触发 Tapped 事件

c++ - 自动转换模板<T>到模板<const T>

java -\G 在 .split 中如何工作?

html - 多行字符串属性值,HTML

video - 如何使用 ffmpeg 将来自摄像机的实时流分成多个 60 秒的 mp4 视频片段

c# - 当 StackPanel 宽度为全宽时,WP8 ListBox DataTemplate 抛出异常

c# - 如何在不同类型的集合之间进行匹配?

c# - 找不到合适的方法来覆盖?

javascript - 将字符串和变量连接成 Jade 的变量名

python - 检查列表中的任何字符串是否包含在另一个列表中的任何字符串中