我有一个用 C# 编写的函数,我想将其转换为 Objective-c。怎么做?
public static string UnicodeUnSign(string s)
{
const string uniChars = "àáảãạâầấẩẫậăằắẳẵặèéẻẽẹêềếểễệđìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵÀÁẢÃẠÂẦẤẨẪẬĂẰẮẲẴẶÈÉẺẼẸÊỀẾỂỄỆĐÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰỲÝỶỸỴÂĂĐÔƠƯ";
const string koDauChars = "aaaaaaaaaaaaaaaaaeeeeeeeeeeediiiiiooooooooooooooooouuuuuuuuuuuyyyyyAAAAAAAAAAAAAAAAAEEEEEEEEEEEDIIIOOOOOOOOOOOOOOOOOOOUUUUUUUUUUUYYYYYAADOOU";
if (string.IsNullOrEmpty(s))
{
return s;
}
string retVal = String.Empty;
for (int i = 0; i < s.Length; i++)
{
int pos = uniChars.IndexOf(s[i].ToString());
if (pos >= 0)
retVal += koDauChars[pos];
else
retVal += s[i];
}
return retVal;
}