我有这些值,我需要保留在我的字符串中
string[] units = new string[] {
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen",
};
string[] tens = new string[] { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };
string[] scales = new string[] { "hundred", "thousand", "million", "billion", "trillion" };
string[] seperators = new string[]{ "and" }
我需要删除除了这些值以外的所有其他内容 所以从这篇文章:
至少七十天
我想得到这个:
三十七
答案 0 :(得分:3)
var strValue = "DUE IN THIRTY SEVEN DAYS".ToLower().Split(' ');
var numbers = (from u in units
join s in strValue on u equals s
select u);
Console.Write(string.Join(" ", numbers));