_Core/Lang/Plugins/Parser/DatePlugin.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Lang;
namespace ComLib.Lang.Extensions
{
/* *************************************************************************
<doc:example>
// Date plugin allows date expressions in a friendly format like January 1 2001;
// Following formats are supported.
var date = January 1st 2012;
var date = Jan
date = jan 10
date = Jan 10 2012
date = Jan 10, 2012
date = Jan 10th
date = Jan 10th 2012
date = Jan 10th, 2012
date = January 10
date = January 10, 2012
date = January 10th
date = January 10th, 2012
date = January 10th 2012 at 9:20 am;
if today is before December 25th 2011 then
print Still have time to buy gifts
</doc:example>
***************************************************************************/
/// <summary>
/// Combinator for handling dates.
/// </summary>
public class DatePlugin : ExprPlugin
{
private static Dictionary<string, int> _months;
static DatePlugin()
{
_months = new Dictionary<string, int>();
_months["jan"] = 1;
_months["feb"] = 2;
_months["mar"] = 3;
_months["apr"] = 4;
_months["may"] = 5;
_months["jun"] = 6;
_months["jul"] = 7;
_months["aug"] = 8;
_months["sep"] = 9;
_months["oct"] = 10;
_months["nov"] = 11;
_months["dec"] = 12;
_months["january"] = 1;
_months["february"] = 2;
_months["march"] = 3;
后面还有 181 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
