GetSubstringAt() public méthode

public GetSubstringAt ( int position, int length ) : string
position int
length int
Résultat string
Exemple #1
0
        private static int Get3CharOrShorterOperatorLength(CharacterStream cs) {
            if (cs.DistanceFromEnd >= 3) {
                string threeLetterCandidate = cs.GetSubstringAt(cs.Position, 3);
                if (threeLetterCandidate.Length == 3) {
                    int index = Array.BinarySearch<string>(_threeChars, threeLetterCandidate);
                    if (index >= 0) {
                        return 3;
                    }
                }
            }

            return Get2CharOrShorterOperatorLength(cs);
        }
Exemple #2
0
        internal static int Get2CharOrShorterOperatorLength(CharacterStream cs) {
            if (cs.DistanceFromEnd >= 2) {
                string twoLetterCandidate = cs.GetSubstringAt(cs.Position, 2);

                if (twoLetterCandidate.Length == 2) {
                    int index = Array.BinarySearch<string>(_twoChars, twoLetterCandidate);
                    if (index >= 0) {
                        return 2;
                    }
                }
            }

            return GetSingleCharOperatorLength(cs.CurrentChar);
        }
 private static bool IsValidDouble(CharacterStream cs, int start, int end) {
     int len = end - start;
     string s = cs.GetSubstringAt(start, len);
     double n;
     return Double.TryParse(s, NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.InvariantCulture, out n);
 }