SplitString() static public méthode

This routine will split the passed in string and return an array of those substrings.
static public SplitString ( string xyz ) : string[]
xyz string string to split
Résultat string[]
Exemple #1
0
        /// <summary>
        /// Read a 'Field' node from the controled xml file that contains the ImportFields
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public bool ReadNode(System.Xml.XmlNode node)
        {
            bool success = true;

            m_node = node;
            foreach (System.Xml.XmlAttribute Attribute in node.Attributes)
            {
                switch (Attribute.Name)
                {
                case "id":
                    m_name = ReadRequiredString(Attribute.Value, ref success);
                    break;

                case "uiname":
                    m_uiName = ReadRequiredString(Attribute.Value, ref success);
                    break;

                case "property":
                    m_property = ReadRequiredString(Attribute.Value, ref success);
                    break;

                case "signature":
                    m_signature = ReadRequiredString(Attribute.Value, ref success);
                    break;

                case "list":
                    m_isList = ReadBoolValue(Attribute.Value, false);
                    break;

                case "multi":
                    m_isMulti = ReadBoolValue(Attribute.Value, false);
                    break;

                case "ref":
                    m_isRef = ReadBoolValue(Attribute.Value, false);
                    break;

                case "autofield":
                    m_isAutoField = ReadBoolValue(Attribute.Value, false);
                    break;

                case "type":
                    m_dataType = ReadRequiredString(Attribute.Value, ref success);
                    break;

                case "unique":
                    m_isUnique = ReadBoolValue(Attribute.Value, false);
                    break;

                case "MDF":
                    STATICS.SplitString(Attribute.Value, ref m_mdfMarkers);
                    break;

                default:
                    break;
                }
            }
            return(success);
        }
        private bool ReadSignatureNode(System.Xml.XmlNode node)
        {
            System.Xml.XmlAttribute nameAttr = node.Attributes["names"];
            if (nameAttr == null)
            {
                return(false);
            }
            string sigNames = nameAttr.Value;

            string [] sigs = STATICS.SplitString(sigNames);
            m_AbbrSignatures = new List <string>(sigs);
            return(true);
        }
Exemple #3
0
 public LexImportField(string name, string uiDest, string prop, string sig, bool list, bool multi, bool unique, string mdf)
 {
     m_name       = name;
     m_uiName     = uiDest;
     m_property   = prop;
     m_dataType   = "string";            // default if not given
     m_signature  = sig;
     m_isList     = list;
     m_isMulti    = multi;
     m_isUnique   = unique;
     m_mdfMarkers = new Hashtable();
     STATICS.SplitString(mdf, ref m_mdfMarkers);
 }
 public ClsInFieldMarker(string begin, string endList,
                         bool fEndWithWord, bool fEndWithField, string lang, string xmlLang, string style, bool ignore)
 {
     m_EndList = new ArrayList();
     m_Begin   = begin;
     // change from a delimited string to an arraylist
     STATICS.SplitString(endList, delim, ref m_EndList);
     m_fEndWithWord    = fEndWithWord;
     m_fEndWithField   = fEndWithField;
     m_Language        = lang;
     m_xmlLang         = xmlLang;        // string to use for the ws (writing System)
     m_style           = style;
     m_ignore          = ignore;
     m_UseXmlLangValue = false;
 }
        public bool ReadXmlNode(System.Xml.XmlNode node, Hashtable languages)
        {
            bool Success = true;

            m_fEndWithField = false;
            m_fEndWithWord  = false;
            foreach (System.Xml.XmlAttribute Attribute in node.Attributes)
            {
                // Create new attribute details, which may be altered later on:
                string newValue = Attribute.Value;
                switch (Attribute.Name)
                {
                case "element":
                    m_XmlElementName = Attribute.Value;
                    break;

                case "begin":
                    m_Begin = Attribute.Value;
                    break;

                case "end":
                case "endList":
                    STATICS.SplitString(newValue, delim, ref m_EndList);
                    break;

                case "endWithField":
                    m_fEndWithField = IsTrue(Attribute.Value);
                    break;

                case "endWithWord":
                    m_fEndWithWord = IsTrue(Attribute.Value);
                    break;

                /*
                 * case "lang":
                 * // Look up replacement language name:
                 * ClsLanguage language = languages[Attribute.Value] as ClsLanguage;
                 * if (language == null)
                 * {
                 *      Converter.Log.AddError("Error in Mapping File: Unknown 'lang' value '" + Attribute.Value + "' in the 'fieldDescriptions' section.");
                 *      m_xmlLanguage = newValue;
                 * }
                 * else
                 *      m_xmlLanguage = language.XmlLang;
                 *
                 * m_Language = newValue;
                 * break;
                 * */
                case "lang":
                    newValue = null;
                    // Look up replacement language name:
                    ClsLanguage language = languages[Attribute.Value] as ClsLanguage;
                    if (language != null)
                    {
                        newValue   = language.XmlLang;
                        m_Language = language.KEY;
                        m_xmlLang  = language.XmlLang;
                    }
                    else
                    {
                        Converter.Log.AddError(String.Format(Sfm2XmlStrings.UnknownLangValue0InTheInFieldMarkers, Attribute.Value));
                        newValue = Attribute.Value;
                    }
                    break;

                case "style":
                    m_style = Attribute.Value;
                    break;

                case "ignore":
                    m_ignore = STATICS.IsBoolString(Attribute.Value, false);
                    break;

                default:
                    Converter.Log.AddWarning(String.Format(Sfm2XmlStrings.UnknownAttribute0InTheInFieldMarkers, Attribute.Name));
                    Success = false;
                    break;
                }
            }

            if (m_Begin == null)
            {
                Converter.Log.AddError(Sfm2XmlStrings.BeginNotDefinedInAnInFieldMarker);
                Success = false;
            }
            if (m_EndList.Count == 0 && !m_fEndWithWord && !m_fEndWithField)
            {
                Converter.Log.AddError(String.Format(Sfm2XmlStrings.InFieldMarker0HasNoEndAttribute, m_Begin));
                Success = false;
            }
            if (m_XmlElementName == null)
            {
                Converter.Log.AddError(String.Format(Sfm2XmlStrings.InFieldMarker0HasNoElementNameAttribute, m_Begin));
                Success = false;
            }

            return(Success);
        }