PowerShell to remove text from a string

前端 未结 5 555
不思量自难忘°
不思量自难忘° 2020-12-06 09:59

What is the best way to remove all text in a string after a specific character? In my case "=" and after another character in my case a ,, but keep th

5条回答
  •  时光说笑
    2020-12-06 10:30

    $a="some text =keep this,but not this"
    $a.split('=')[1].split(',')[0]
    

    returns

    keep this
    

提交回复
热议问题