I have string "10-1283-01" the length going to be same , i want to check is that string like "10-xxxx-0x" only want first 3 character like "10-" and last but one two character like "-0".
So I am diving/Substring something like below. for first3 its giving me required string but for lastPart its giving me ArgumentOutOfRangeException.
Please let me know how i will get -0 string? Thanks in Advance
string partnoveri = lpartno.Text; string first3=partnoveri.Substring(0, 3); string lastPart = partnoveri.Substring(partnoveri.IndexOf("-0"),partnoveri.Length-1);