本文整理汇总了C#中Match.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Match.ToString方法的具体用法?C# Match.ToString怎么用?C# Match.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: isPalindrome
static bool isPalindrome(Match word)
{
string wordString = word.ToString();
for (int i = 0; i < wordString.Length; i++)
{
if (wordString[i] != wordString[wordString.Length - i - 1])
{
return false;
}
}
return true;
}
示例2: ParseDate
private static object ParseDate(Match item, string format)
{
try
{
DateTime parsedDate = DateTime.ParseExact(item.ToString(), format, null);
return parsedDate;
}
catch (Exception)
{
return "Cannot parse";
}
}
示例3: Evaluate
/// <summary>
/// Evaluates whether the text has spaces, page breaks, etc. and removes them.
/// </summary>
/// <param name="Matcher">The matched text</param>
/// <returns>Stripped text</returns>
private static string Evaluate(Match Matcher)
{
string MyString = Matcher.ToString();
if (string.IsNullOrEmpty(MyString))
return "";
MyString = Regex.Replace(MyString, @"\r\n\s*", "");
return MyString;
}
示例4: RepBold
public static String RepBold(Match m)
{
string str = m.ToString();
return String.Format("<b>{0}</b>", str);
}
示例5: Rep3
public static String Rep3(Match input)
{
String s = String.Empty;
if (input.ToString().Equals("a"))
s = "A";
if (input.ToString().Equals("b"))
s = "B";
if (input.ToString().Equals("c"))
s = "C";
return s;
}
示例6: Rep1
public static String Rep1(Match input)
{
String s = String.Empty;
if (String.Compare(input.ToString(), "Big", StringComparison.CurrentCultureIgnoreCase) == 0)
s = "Huge";
else
s = "Tiny";
return s;
}
示例7: dotToDash
static string dotToDash(Match m)
{
string x = m.ToString();
return x.Replace(@".", @"_");
}
示例8: VariableReplacer
private string VariableReplacer(Match match)
{
string returnValue;
if (varStorage.TryGetValue(match.ToString().Substring(1, match.Length - 2), out returnValue))
{
return returnValue;
}
return "";
}
示例9: _replaceEscapeSequenceToChar
//replace "0A" (in \x0A) into '\n'
private string _replaceEscapeSequenceToChar(Match foundEscapeSequence)
{
char[] hexValues = new char[2];
//string hexChars = foundEscapeSequence.Value.ToString();
string matchedEscape = foundEscapeSequence.ToString();
hexValues[0] = matchedEscape[2];
hexValues[1] = matchedEscape[3];
string hexValueString = new string(hexValues);
int convertedInt = int.Parse(hexValueString, NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo);
char hexChar = Convert.ToChar(convertedInt);
string hexStr = hexChar.ToString();
return hexStr;
}
示例10: URL
private static string URL(Match m)
{
string x = m.ToString();
return x.Link(x);
}
示例11: Rep1
public static string Rep1(Match input)
{
if (string.Compare(input.ToString(), "Big", StringComparison.CurrentCultureIgnoreCase) == 0)
return "Huge";
else
return "Tiny";
}
示例12: Username
private static string Username(Match m)
{
string x = m.ToString();
string username = x.Replace("@", "");
return x.Link("http://twitter.com/" + username);
}
示例13: Hashtag
private static string Hashtag(Match m)
{
string x = m.ToString();
string tag = x.Replace("#", "%23");
return x.Link("http://search.twitter.com/search?q=" + tag);
}
示例14: MatchEval
/// <summary>
/// Called to evaluate the HTML fragment corresponding to each
/// matching token in the code.
/// </summary>
/// <param name="match">The <see cref="Match"/> resulting from a
/// single regular expression match.</param>
/// <returns>A string containing the HTML code fragment.</returns>
protected override string MatchEval(Match match)
{
if (match.Groups[1].Success) //comment
{
var reader = new StringReader(match.ToString());
string line;
var sb = new StringBuilder();
while ((line = reader.ReadLine()) != null)
{
if (sb.Length > 0)
{
sb.Append("\n");
}
sb.Append("<span class=\"rem\">");
sb.Append(line);
sb.Append("</span>");
}
return sb.ToString();
}
if (match.Groups[2].Success) //string literal
{
return "<span class=\"str\">" + match.ToString() + "</span>";
}
if (match.Groups[3].Success) //preprocessor keyword
{
return "<span class=\"preproc\">" + match.ToString() + "</span>";
}
if (match.Groups[4].Success) //keyword
{
return "<span class=\"kwrd\">" + match.ToString() + "</span>";
}
System.Diagnostics.Debug.Assert(false, "None of the above!");
return ""; //none of the above
}
示例15: MyMatchEvaluator
public static string MyMatchEvaluator(Match m)
{
matched = true;
string matchedString = m.ToString();
if (addJsType)
{
var lastDir = "";
{
// add "../../...." to reach Assets/
int i = 0;
var np = nextPath;
while (true)
{
i = np.IndexOf('/', i);
if (i < 0) break;
lastDir += "../";
i++;
}
}
string JsTypeSection = string.Format("[JsType(JsMode.Clr,\"{0}{1}{2}{3}{4}\")]",
lastDir, JSBindingSettings.sharpKitGenFileDir, nextPath, m.Groups["ClassName"], JSBindingSettings.jsExtension);
// ���JsType�����Ѿ���������ͬ���Ͳ�Ҫ���ˣ�ֱ�ӷ�����ͬ�Ĵ�
if (matchedString.IndexOf(JsTypeSection) >= 0)
return matchedString;
else
return string.Format("\n{0}\n{1}", JsTypeSection, m.Groups["ClassDefinition"]);
}
else
{
// ���û�� JsType���Ͳ�Ҫ�滻�ˣ���Ϊ�滻��Ӹ�\n���ᵼ���ļ���
// ��Ȼ�������������� JsType���Ǿ��滻һ�£��Ӹ����У�Ҳû��
if (matchedString.IndexOf("JsType") < 0)
return matchedString;
else
return string.Format("\n{0}", m.Groups["ClassDefinition"]);
}
}