I have this string:
“B82V16814133260”
what would be the most efficient way to get two strings out of it:
left part String: “B82V”
rigth part string: “16814133260”
The rule is this: take all numbers on the right side and create string out of them, then take the reminder and place it into another string.
This is my solution, but it is too bulky! How to do it short and efficient?
String leftString = "";
String rightString="";
foreach (char A in textBox13.Text.Reverse())
{
if (Char.IsNumber(A))
{
rightString += A;
}
else
{
break;
}
}
char[] arr = rightString.ToArray();
Array.Reverse(arr);
rightString=new string(arr);
leftString = textBox13.Text.Replace(rightString, "");
This yields what you’re expecting: