繁体   English   中英

C#中的简码解析器

[英]Shortcode parser in C#

可能以前曾问过这个问题,但没有适当的解决方案,至少我找不到。

我在C#中有一个CMS,该文章保存在数据库中,并且在加载该文章时需要它,它应该解析可用的短代码(如Wordpress)。

string str = "Hello there, show my name as [shortcodeX val="Garth"]";

我需要的是一些帮助,可以根据所调用的短代码来解析它。

public string shortcodeX(string val)
{
    return "hi" + val;
}

string str = ParseStringForShortCode(str);

我希望我能够在这里解释要求并寻求帮助

PS:我在PHP的Shortcode插件中找到了一些自定义cms的东西, 例如wordpress shortcode插件,但是由于我不了解PHP,所以很难理解。

这似乎是您需要的: https : //github.com/aolde/shortcoder

您也可以通过NuGet安装它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM