How to split and trim a string to list string?

Hi Everybody

I have a string and i want to use activity split and trim to change the other list strings,
but i dont know how to do this.

oldstr = "詳細 振替固定テンプ 173917 2022/06/02 :09001:2022/06/02 詳細 振替固定テンプ 173917 2022/06/02 2,02 手形 05/31 92日 :09001:2022/06/02 "

newListStr ={“詳細 振替固定テンプ 173917 2022/06/02 :09001:2022/06/02”,"詳細 振替固定テンプ 173917 2022/06/02 2,02 手形 05/31 92日 :09001:2022/06/02 "}

String start: 詳細
String end :09001:2022/06/02 ⇒ The time is time of today.

Can you help me?

Best regards.

@Phuong_Bui May I know why do you wan to use split is it for extracting data from the list. if yes, let me know what data you want to extract

newListStr = {“Detailed transfer fixed balance 173917 2022/06/02: 09001: 2022/06/02”, “Detailed transfer fixed balance 173917 2022/06/02 2,02 Bill 05/31 92nd: 09001: 2022/06 / 02 "}

Hi @ushu
I want to extract oldstr to 2 strings. New string starts with “詳細” and ends with “09001:2022/06/02” (Note: “2022/06/02” is flexible time by day)
You can look like that:
“詳細 振替固定テンプ 173917 2022/06/02 :09001:2022/06/02”
“詳細 振替固定テンプ 173917 2022/06/02 2,02 手形 05/31 92日 :09001:2022/06/02”

You can use Regex.Split:

newListStr = System.Text.RegularExpressions.Regex.Split(oldstr.Trim, "(?<=\d{4}/\d{2}/\d{2}) ?(?=詳細)")

where newListStr is an array of string.

Hi @ptrobot

Thanks so much for your answer, it worked.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.