怎么样才能把某些零散的字符串组成我想要的字符串
我现在手头上有形如这样的一组字符串
00-01-08 (hex) AVLAB Technology, Inc.
000108 (base 16) AVLAB Technology, Inc.
3F-1, No. 134, Sec. 3
Chung Shin Road
Hsin Tien, Taipei
TAIWAN, PROVINCE OF CHINA
我想给整理成
m_Companies.Add("00-01-08", new PhysAddressCompany("00-01-08", "000108", "AVLAB Technology, Inc.", "3F-1, No. 134, Sec. 3 Chung Shin Road Hsin Tien, Taipei TAIWAN, PROVINCE OF CHINA"));
样子,但是所在txt里还有像下面这样的字符
00-01-09 (hex) Nagano Japan Radio Co., Ltd.
000109 (base 16) Nagano Japan Radio Co., Ltd.
Nagano Japan Radio Co., Ltd.
00-01-01 (hex) PRIVATE
000101 (base 16)
这样我想就变成
m_Companies.Add("00-01-09", new PhysAddressCompany("00-01-09", "000109", "Nagano Japan Radio Co., Ltd.", ""));
m_Companies.Add("00-01-01", new PhysAddressCompany("00-01-01", "000101", "PRIVATE", ""));
也会有那种只能在 utf-8里识别的出的字符像下面这样
00-01-2A (hex) Telematica Sistems Inteligente
00012A (base 16) Telematica Sistems Inteligente
Rua Miguel Casagrande, 200
S?o Paulo
BRAZIL
规律是一组的上下都有空行,能不能用正则表达式识别出或者有其他什么更简单的,更不容易错的方法,但是第一第二行的括号部分想不出怎么去掉。因为有1万5千组这样的文本,所以不知道有什么速度快效率高的方法
------解决方案--------------------正则表达式匹配,用string.Format拼接。
------解决方案--------------------测试如下
string input = @"00-01-08 (hex) AVLAB Technology, Inc.
000108 (base 16) AVLAB Technology, Inc.
3F-1, No. 134, Sec. 3