private int GetHeadIndex(int headIndex, string str) { int retIndex = headIndex; return Math.Max(0, retIndex); }