I have a string list having characters with numbers. I just wanted to split the string to get the number and later I need to find the max number from that splitted number list.

**Match String**

```
abc

```

**Example List Values**

```
abc9
abc100
abc999
abc

```

**Result**

```
abc1000

```

**I have tried the below code**

```
string Result="";
var SF = (from site in db.SF where site.Code == "xyz" select site.Line2).FirstOrDefault();   // Here I ll get "abc"
                    int Count = (from Ps in db.Ps where Ps.No.StartsWith(SF) select Ps.No).ToList().Count;
                    if (Count != 0)
                    {
                        var PNo = (from Ps in db.Ps where Ps.No.StartsWith(SF) select Ps.No).ToList().LastOrDefault();
                        if (PNo != null)
                        {
                            int Val = Convert.ToInt32(PNo.Replace(SF, "")) + 1;  // Here I need to get `abc1000` based on the above ex. list.
                            Res = SF + Val.ToString();
                        }
                    }
                    else
                    {
                        Result = SF + "1";
                    }

```

When I execute the code, It always comes with "abc10" after It reached "abc45". Any help in providing the generic logic will be appreciated.

Thanks