domingo, 19 de outubro de 2008

SharePoint Escaped Characters (Converter Functions) NEW VERSION

SharePoint Escaped Function

This stuff is very useful to control a Internal Name of the fields,
or verify the Internal Name from the Display Name in a list.

It’s usual, the internal names of the fields do not have more than 32 characters.

The string array list with all characters

private static string[] charactersArrayString =
{"ã","á","à","â","ä","Ã","Á","À","Â","Ä","é","è","ê","ë", "É","È",
"Ê","Ë","í","ì","î","ï","Í","Ì","Î","Ï","ó","ò",
"ô","ö","õ","Ò","Ó","Ô","Ö","Õ","ú","ù","û","ü","Ù","Ú",
"Û","Ü","ç","Ç","ñ","Ñ","ª","º","(",")","!",@"\",@",","$",
"%","&", "/","=","?","@","£","§","{","[","]","}","?","»",
"«","»","~","+","*",";","","¨",":"," ","-"};
The function to create or guess what is the field name

public static string EscapedSpecialCharacters(string myTextToConvert)
{
foreach (string myCaracter in charactersArrayString)
if (myTextToConvert.Contains(myCaracter))
myTextToConvert = myTextToConvert.Replace(myCaracter,
myHexFunctionHelper(myCaracter)); return myTextToConvert.Length > 32 ?
myTextToConvert.Remove(32) : myTextToConvert;
}

Enjoy!!!

Sem comentários: