Use the first part of the split

Asked

Viewed 47 times

2

I wonder if you have how to use the split to make only one division, for example, I have the following text:: dia_24_06_18.

I wanted you to separate by _ in the matrix like this:

[0] - dia
[1] - 24_06_18
  • 2

    Yes Luisa: that way: string c = "dia_24_06_18"; var res = c.Split(new[] { '_' }, 2, StringSplitOptions.None); will be res[0] and res[1] Example: https://dotnetfiddle.net/wXSimw

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.