Ejemplo n.º 1
0
 /// <summary>Suchstring umsetzten</summary>
 /// <param name="sString"></param>
 private void parseSearchString(String sString)
 {
     if (!ClassStringTools.IsNullOrWhiteSpace(sString))
     {
         if (sString == "*")
         {
             regexSearch = ".*";
         }
         else if (sString.StartsWith("*"))
         {
             sString     = sString.Replace(".", @"\.");
             regexSearch = "^(.*)(" + sString.Substring(1) + ")$";
         }
         else if (sString.EndsWith("*"))
         {
             sString     = sString.Replace(".", @"\.");
             regexSearch = "^(" + sString.Substring(0, sString.Length - 1) + ")(.*)$";
         }
         else if (Regex.IsMatch(sString, @"^(?:\w|\d|\s|\.|-)*$"))
         {
             regexSearch = "^(" + sString + ")$";
         }
         else
         {
             regexSearch = sString;
         }
         checker = new Regex(regexSearch);
     }
 }
Ejemplo n.º 2
0
        /// <summary>Gibt einen 'hochgezählten' Text zurück</summary>
        /// <param name="numbertext"></param>
        /// <returns></returns>
        public static String getTextIncrement(String numbertext)
        {
            String defaultPunktnummer = numbertext;
            Double lastnumber;
            Int32  numberPos;

            if (ClassStringTools.getLastNumbersAsDouble(defaultPunktnummer, out lastnumber, out numberPos))
            {
                if (!Double.IsNaN(lastnumber))
                {
                    Int32 digits = ClassMath.getDigitCount(lastnumber);
                    lastnumber += ClassMath.getDigitFactor(lastnumber);
                    if (numberPos == -1)
                    {
                        numberPos = 0;
                    }
                    String pktNr = defaultPunktnummer.Substring(0, numberPos) + ClassConverters.ToString(lastnumber, ".", "", digits, true).Trim();
                    if (pktNr.Length < defaultPunktnummer.Length)
                    {
                        Int32 nullen = defaultPunktnummer.Length - pktNr.Length;
                        pktNr = defaultPunktnummer.Substring(0, numberPos) + new String('0', nullen) +
                                ClassConverters.ToString(lastnumber, ".", "", digits, true).Trim();
                    }
                    defaultPunktnummer = pktNr;
                }
            }
            return(defaultPunktnummer);
        }