31
1
using System;
2
public static class Program
3
{
4
public static void Main()
5
{
6
string dq = "\"";
7
string numbers = "12345";
8
9
Console.WriteLine( dq + numbers.TrimStart(1) + dq );
10
Console.WriteLine( dq + numbers.TrimStart(50) + dq );
11
Console.WriteLine( dq + numbers.TrimEnd(1) + dq );
12
Console.WriteLine( dq + numbers.TrimEnd(50) + dq );
13
}
14
15
public static string TrimStart(this string input, int length)
16
{
17
if (string.IsNullOrEmpty(input) || length < 0) return input;
18
19
if (length > input.Length) return input;
20
21
return input.Substring(length);
22
}
23
public static string TrimEnd(this string input, int length)
24
{
25
if (string.IsNullOrEmpty(input) || length < 1) return input;
26
27
if (length > input.Length) return string.Empty;
28
29
return input.Substring(0, input.Length - length);
30
}
31
}
Cached Result
{"Dict1":{"1":{"First":false,"Second":true},"2":{"First":false,"Second":true},"3":{"First":true,"Second":false}},"Dict2":{"1":{"First":false,"Second":true},"2":{"First":false,"Second":true}},"CustomProperty1":0.0,"CustomProperty2":0.0}