AODL.Document.Content.Text.TextControl.WhiteSpaceHelper.GetWhiteSpaceXml C# (CSharp) Метод

GetWhiteSpaceXml() публичный статический Метод

Convert all whitespace groups " " into OpenDocument Xml textnodes
public static GetWhiteSpaceXml ( string stringToConvert ) : string
stringToConvert string The string to convert.
Результат string
		public static string GetWhiteSpaceXml(string stringToConvert)
		{
			try
			{
				ArrayList matchList		= new ArrayList();
				string pat = @"\s{2,}";
				Regex r = new Regex(pat, RegexOptions.IgnoreCase);
				Match m = r.Match(stringToConvert);

				while (m.Success) 
				{
					WhiteSpaceHelper w		= new WhiteSpaceHelper();
					for(int i=0; i<m.Length; i++)
						w.Value			+= " ";
					w.Replacement		= "<ws id=\""+m.Length.ToString()+"\"/>";//GetXmlWhiteSpace(m.Length);
					matchList.Add(w);
					m = m.NextMatch();
				}

				foreach(WhiteSpaceHelper w in matchList)
					stringToConvert		= stringToConvert.Replace(w.Value, w.Replacement);
				
			}
			catch(Exception)
			{
				//unhandled, only whitespaces arent displayed correct
			}
			return stringToConvert;
		}