I need to get the first char of this string:
String s = "X-4711";
And put it after the number with an ';' , like: 4711;X.
I already tried it with:
String x = s.Split("-")[1] + ";" + s.Split("-")[0];
then I get it, but can I do it better or is this the only possible way?
Splitnotsplit. C# is case sensitive. Second, your solution is quite simple, understandable and efficient I think based on your input. What do you mean by better exactly? Of course you can find another ways but your solution is good in my opinion. If you think this is not good enough, explain why at least.String result = s.Substring(2) + ";" + s.Substring(0, 1);Spliti want it a bit cleaner.