Split 으로 문자열을 자르고 Substring 으로 자른 문자열의 일부를 추출하고싶습니다

Split 으로 문자열을 자르고 Substring 으로 자른 문자열의 일부를 추출하고싶습니다. 어떻게 합쳐야할까요?

Hi,

Can you share specific input data and expected output?

Regards,

BillingRTF.Split({Environment.NewLine},StringSplitOptions.RemoveEmptyEntries)(8)
BillingRTF.SubString(0,12)

Hello @leejiyeon051999

It would be better if you can share the input data and the expected output.
based on that we can provide a solution.

Thanks

Hello @leejiyeon051999

As asked can you provide us the input text you are using and you expected output

If the input is non-sharable share the sample of by changing the sensitive things in the input

Regards
Sudharsan

268094663036 PAYMENT 000
466092468148 PAYMENT 000
668079302272 PAYMENT 000


268094663036
466092468148
668079302272

Hi @leejiyeon051999

You can try with Regex expression

System.Text.RegularExpressions.Regex.Match(YourString,"^\d+").Tostring

Regards
Gokul

Okay So you can try out this

Split(“268094663036 PAYMENT 000”," ")(0)

Regards
Sudharsan

Try with Split expression

Split(YourString," ")(0)

image

Try with Substring

YourString.Substring(0,12)

image

Regards
Gokul

You can Also try this pattern

.*(?=\s[A-Z]+)

System.Text.RegularExpressions.Regex.Match(“268094663036 PAYMENT 000”,“.*(?=\s[A-Z]+)”)Tostring

Regards
Sudharsan

Hi,

How about the following?

strData = BillingRTF.Split(vbcrlf.ToCharArray,StringSplitOptions.RemoveEmptyEntries)(8)

then

strData.SubString(0,12)

Regards,

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