Question: Check if input string entered by user is in format like IIPIII, where I is integer number, any one digit number can be used on place of I and P is a character. 
Example if input is 32P125 it is valid string else N23P33 is invalid.

I tried using `string.Length` or `string.IndexOf("P")` but how to validate other integer values?

Answer: 
It can be encapsulated in one simple `if`:

```
string testString = "12P123";
if(
    // check if third number is letter
    Char.IsLetter(testString[2]) &&
    // if above succeeds, code proceeds to second condition (short-circuiting)
    // remove third character, after that it should be a valid number (only digits)
    int.TryParse(testString.Remove(2, 1), out int i)
) {...}

```
Use simple [Regular expression](//regexone.com/references/csharp) for this kind of stuff.