Split 메서드에 관해서

궁금한 게 있어서 질문드립니다
String str = “가나다 1234” 라는 변수를 공백 기준으로 split 하면 배열로 반환됩니다. 여기에서 결과값 0번째 인덱스만 따로 가져오고 싶습니다.
기존에는 따로 string 배열을 선언하고, 그 결과값을 배열에 저장하고 0번째 인덱스를 줬었는데 더 간편한 방법이 있나요?

Hi @mat-tang

put it like this
Output_string = your_str.Split(" ",c).First

It will return the 0th index

Hope it solves your issue

Thanks
Robin

1 Like

Hi @mat-tang

You can also try this alternative way to achieve the output

OT_String = Split(“가나다 1234”," ")(0)

OT_String → String Variable

image

Hope it will solve you query

Regards
Gokul

thank you so much! I solved this questions!!

If you issue resolved can you mark it as solution so that it will be helpful to others also

I didn’t know this method! Thanks to your help @Gokul001

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