excel - 在特定单词处拆分字符串并创建新行
问题描述
我正在尝试在单词“material_cd”处拆分此字符串,并让它使用拆分字符串创建一个新行。
material_cd = 10798259 AND inputportcount 24 material_cd = 10798259 AND outputportcount 144 material_cd = 10798259 AND inputblockcount 1 material_cd = 10798259 AND outputblockcount 1 material_cd = 10798259 AND bv_type_name FDH material_cd = 10798259 AND manufacturer Corning material_cd = 10798259 AND partnumber N/A material_cd = 10798259 AND bv_status Preliminary设计材料 CD = 10798259 AND bv_tail_length 25
期望的结果:
material_cd = 10798259 AND inputportcount <> 24
material_cd = 10798259 AND outputportcount <> 144
material_cd = 10798259 AND inputblockcount <> 1
material_cd = 10798259 AND outputportcount <> 1
....等等
这可能吗?
解决方案
像这样的东西,
Sub tt()
Dim s As String
Dim a() As String
s = "material_cd = 10798259 AND inputportcount 24 material_cd = 10798259 AND outputportcount 144 material_cd = 10798259 AND inputblockcount 1 material_cd = 10798259 AND outputblockcount 1 material_cd = 10798259 AND bv_type_name FDH material_cd = 10798259 AND manufacturer Corning material_cd = 10798259 AND partnumber N/A material_cd = 10798259 AND bv_status Preliminary Designed material CD = 10798259 AND bv_tail_length 25"
s = Replace(s, "material_cd", "*^*material_cd")
a = Split(s, "*^*")
Range("a1").Resize(UBound(a) - 1, 1).Value = Application.Transpose(a)
End Sub
推荐阅读
- java - 具有嵌套值的 JSON 到 POJO
- xamarin.android - Toolbar back click is not working in Xamarin android
- php - (PHP, MYSQL) 结果无法转换为字符串
- c++ - 非指针类成员:有多好?
- php - 如果没有迁移,Laravel Lumen 迁移会失败
- neural-network - 为什么不填充而不是扭曲 CNN 的图像
- eclipse - maven-build 不创建 .war 文件
- regex - 如何使用正则表达式从logstash中的字段键中删除前缀下划线
- selenium - Selenium:类型不匹配:无法从 Class 转换
到类[] - javascript - Uint8Array 到 JavaScript 中的图像