ParserExtensions.cs 574 B

1234567891011121314151617181920212223
  1. using System.Collections.Generic;
  2. namespace Jint.Parser
  3. {
  4. public static class ParserExtensions
  5. {
  6. public static string Slice(this string source, int start, int end)
  7. {
  8. return source.Substring(start, end - start);
  9. }
  10. public static char CharCodeAt(this string source, int index)
  11. {
  12. if (index < 0 || index > source.Length - 1)
  13. {
  14. // char.MinValue is used as the null value
  15. return char.MinValue;
  16. }
  17. return source[index];
  18. }
  19. }
  20. }