我想从一个数组只找到了第一个三个字符的字符串的索引查找的字符串(前三个字符)的索引如何从一个数组
我有一个月的数组
string[] arrayEnglishMonth = { "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER" };
如果我写
int t_ciMonth=8;(AUGUST)
int pos = Array.IndexOf(t_caMonth, arrayEnglishMonth[t_ciMonth - 1]);
但是,如果我想要的指数仅前3个字符,即AUG如何找呢?
您的意思是您想要查找数组中以给定字符串开头的第一个字符串的索引,例如, “AUG”? –
您确实知道[DateTimeFormatInfo.GetMonthName](http://msdn.microsoft.com/library/system.globalization.datetimeformatinfo.getmonthname.aspx)和[DateTimeFormatInfo.GetAbbreviatedMonthName](http://msdn.microsoft.com/库/ system.globalization.datetimeformatinfo.getabbreviatedmonthname.aspx)? – Corak
是.............................. – Proneet