當前位置: 首頁>>代碼示例>>C#>>正文


C# String.All方法代碼示例

本文整理匯總了C#中System.String.All方法的典型用法代碼示例。如果您正苦於以下問題:C# String.All方法的具體用法?C# String.All怎麽用?C# String.All使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.String的用法示例。


在下文中一共展示了String.All方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ParseSize

        public static Int64 ParseSize(String sizeString, Boolean defaultToBinaryPrefix)
        {
            if (sizeString.All(char.IsDigit))
            {
                return Int64.Parse(sizeString);
            }

            var match = ParseSizeRegex.Matches(sizeString);

            if (match.Count != 0)
            {
                var value = Decimal.Parse(Regex.Replace(match[0].Groups["value"].Value, "\\,", ""), CultureInfo.InvariantCulture);

                var unit = match[0].Groups["unit"].Value.ToLower();

                switch (unit)
                {
                    case "kb":
                        return ConvertToBytes(Convert.ToDouble(value), 1, defaultToBinaryPrefix);
                    case "mb":
                        return ConvertToBytes(Convert.ToDouble(value), 2, defaultToBinaryPrefix);
                    case "gb":
                        return ConvertToBytes(Convert.ToDouble(value), 3, defaultToBinaryPrefix);
                    case "kib":
                        return ConvertToBytes(Convert.ToDouble(value), 1, true);
                    case "mib":
                        return ConvertToBytes(Convert.ToDouble(value), 2, true);
                    case "gib":
                        return ConvertToBytes(Convert.ToDouble(value), 3, true);
                    default:
                        return (Int64)value;
                }
            }
            return 0;
        }
開發者ID:nnic,項目名稱:Sonarr,代碼行數:35,代碼來源:RssParser.cs

示例2: isStrongPassword

        /*
         * Validates that password is a strong password
         * Conditions:
         *      Special characters not allowed
         *      Spaces not allowed
         *      At least one number character
         *      At least one capital character
         *      Between 6 to 12 characters in length
         */
        public static bool isStrongPassword(String password)
        {
            // Check for null
            if (password == null)
                return false;

            // Minimum and Maximum Length of field - 6 to 12 Characters
            if (password.Length < passwordLowerBoundary || password.Length > passwordUpperBoundary)
                return false;

            // Special Characters - Not Allowed
            // Spaces - Not Allowed
            if (!(password.All(c => char.IsLetterOrDigit(c))))
                return false;

            // Numeric Character - At least one character
            if (!password.Any(c => char.IsNumber(c)))
                return false;

            // At least one Capital Letter
            if (!password.Any(c => char.IsUpper(c)))
                return false;

            return true;
        }
開發者ID:purdue-cs-groups,項目名稱:cs307-project01,代碼行數:34,代碼來源:InputValidator.cs

示例3: IsValidFolderName

        public static bool IsValidFolderName( String name )
        {
            Contract.Requires( !String.IsNullOrWhiteSpace( name ) );

            // check system names

            if( String.IsNullOrWhiteSpace( name ) || name == "." || name == ".." )
            {
                return false;
            }

            // whitespace and the start or end not allowed
            if( name[ 0 ] == WhiteSpace || name[ name.Length - 1 ] == WhiteSpace )
            {
                return false;
            }

            // max length
            if( name.Length > QuickIOPath.MaxFolderNameLength )
            {
                return false;
            }

            // point at the beginning or at the end is not allowed
            // windows would automatically remove the point at the end
            if( name[ 0 ] == '.' || name[ name.Length - 1 ] == '.' )
            {
                return false;
            }

            return name.All( IsValidFolderChar );
        }
開發者ID:Invisibility,項目名稱:QuickIO,代碼行數:32,代碼來源:QuickIOPath.IsValid.cs

示例4: ContainsInvalidFileNameChars

        /// <summary>
        /// Checks if passed string can be used as a filename or it contains
        /// some invalid characters.
        /// </summary>
        /// <param name="source">A string to test.</param>
        /// <returns><see langword="true"/> if string contains invalid characters.</returns>
        public static Boolean ContainsInvalidFileNameChars(String source)
        {
            Contract.Requires(source != null);

            Char[] chars = Path.GetInvalidFileNameChars();

            Contract.Assert(chars != null);

            return source.All(s => chars.All(c => s != c));
        }
開發者ID:martin211,項目名稱:aimp_DiskCover,代碼行數:16,代碼來源:Algorithms.cs

示例5: isValidYYMM

 public static bool isValidYYMM(String s)
 {
     if (s.Length != 4)
     return false;
     if (!s.All(Char.IsDigit))
     return false;
     String mm = s.Substring(2, 2);
     int month = int.Parse(mm);
     if ((month < 1) || (month > 12))
     return false;
     return true;
 }
開發者ID:Phil-Ruben,項目名稱:Residuals,代碼行數:12,代碼來源:Helper.cs

示例6: Main

        public static void Main(String[] args)
        {
            Contract.Requires(!ReferenceEquals(args, null));
            Contract.Requires(args.All(s => !String.IsNullOrWhiteSpace(s)));
            Contract.Requires(args.Length >= 2);
            Contract.Requires(File.Exists(args[1]));

            if (args.Length < 2)
            {
                Console.WriteLine("To start the PocketInvester Server use:");
                Console.WriteLine("./Server.exe <predictor name> <path to FIXML>");
                return;
            }
            Log.Write("PocketInvestor starting.");
            ServerClass server = new ServerClass(args[0], args[1]);

            if (args.Any(a => a.Equals("-genkeys")))
                server.GenerateKeyFiles();

            server.requestManager.StartServer();
        }
開發者ID:MathiasBrandt,項目名稱:pocketinvestor,代碼行數:21,代碼來源:ServerClass.cs

示例7: Keywords


//.........這裏部分代碼省略.........
                    .Where
                    (
                            row => searchTerms.Any
                            (
                                term => row.title.ToLower().Contains(term)
                            )
                    );
                    var p2 = _productlist
                            .Where
                        (
                                row => searchTerms.Any
                                (
                                    term => row.description.ToLower().Contains(term)
                                )
                        );
                    var p3 = _productlist
                        .Where
                        (
                                row => searchTerms.Any
                                (
                                    term => row.keywords.ToLower().Contains(term)
                                )
                        );

                    _productlist = p1.Union(p2).ToList();

                }
                else if (mode == "all")
                {

                    var p1 = _productlist
                            .Where
                            (
                                    row => searchTerms.All
                                    (
                                        term => row.title.ToLower().Contains(term)
                                    )
                            );
                    var p2 = _productlist
                            .Where
                        (
                                row => searchTerms.All
                                (
                                    term => row.description.ToLower().Contains(term)
                                )
                        );
                    var p3 = _productlist
                        .Where
                        (
                                row => searchTerms.All
                                (
                                    term => row.keywords.ToLower().Contains(term)
                                )
                        );

                    _productlist = p1.Union(p2).ToList();

                    //_productlist.Union(p3);

                }
            }
            else if (fieldname == "title")
            {
                if (mode == "exact")
                {
                    _productlist = _productlist
開發者ID:oldspdx,項目名稱:store-api-test,代碼行數:67,代碼來源:Search.cs

示例8: IsNumbers

 public static Boolean IsNumbers(String value)
 {
     return value.All(Char.IsDigit);
 }
開發者ID:cozy1,項目名稱:rocksmith-custom-song-toolkit,代碼行數:4,代碼來源:MainDB.cs

示例9: comprobarTipos

 public bool comprobarTipos(String telefono, String documento)
 {
     return (telefono.All(char.IsDigit) && documento.All(char.IsDigit));
 }
開發者ID:nicogaray,項目名稱:gestiondevagos,代碼行數:4,代碼來源:Alta.cs

示例10: comprobarTipos

 public bool comprobarTipos(String precio, String cantidad)
 {
     return (precio.All(char.IsDigit) && cantidad.All(char.IsDigit));
 }
開發者ID:nicogaray,項目名稱:gestiondevagos,代碼行數:4,代碼來源:ModificarBorradorCompra.cs

示例11: CheckDigits

 /// <summary>
 /// Chequea que el string solo contenga digitos;
 /// </summary>
 /// <param name="value">String a chequear</param>
 /// <exception cref="ExcepcionesSKD.InformacionPersonalInvalidaException">
 /// Si el el valor contiene algún caracter que no sea dígito.
 /// </exception>
 private void CheckDigits(String value)
 {
     if (!value.All(char.IsDigit))
             throw new InformacionPersonalInvalidaException("La información de Telefono solo deben ser digitos.");
 }
開發者ID:rosmantorres,項目名稱:sakaratedo,代碼行數:12,代碼來源:Telefono.cs

示例12: isValidUsername

        /*
         * Validates that username is correct format
         * Conditions:
         *      Special characters not allowed
         *      Spaces not allowed
         *      Between 4-12 characters in length
         */
        public static bool isValidUsername(String username)
        {
            // Check for null
            if (username == null)
            {
                return false;
            }

            // Minimum and Maximum Length of field - 4 to 12 Characters
            if (username.Length < usernameLowerBoundary || username.Length > usernameUpperBoundary)
                return false;

            // Special Characters - Not Allowed
            // Spaces - Not Allowed
            if (!(username.All(c => char.IsLetterOrDigit(c))))
                return false;

            return true;
        }
開發者ID:purdue-cs-groups,項目名稱:cs307-project01,代碼行數:26,代碼來源:InputValidator.cs

示例13: ValidateIntSearchKey

        public bool ValidateIntSearchKey(String SearchKey)
        {
            Int64 id;
            if (string.IsNullOrEmpty(SearchKey) || !SearchKey.All(i => Char.IsDigit(i)) || !Int64.TryParse(SearchKey, out id))
            {
                MessageBox.Show("Please enter valid search key");
                return false;
            }

            return true;
        }
開發者ID:yunsiong,項目名稱:DPPD-Dental-Clinic-Management-System,代碼行數:11,代碼來源:Data+Validator.cs

示例14: ValidateNumber

 public bool ValidateNumber(String Num)
 {
     // Home number validation
     if (string.IsNullOrEmpty(Num) || !Num.All(C => Char.IsDigit(C)))
     {
         return false;
     }
     return true;
 }
開發者ID:yunsiong,項目名稱:DPPD-Dental-Clinic-Management-System,代碼行數:9,代碼來源:Data+Validator.cs

示例15: ValidateName

 public bool ValidateName(String Name)
 {
     // Name Validation
     if (string.IsNullOrEmpty(Name) || !Name.All(C => Char.IsLetter(C) || Char.IsWhiteSpace(C)))
     {
         MessageBox.Show("Please enter valid Name");
         return false;
     }
     return true;
 }
開發者ID:yunsiong,項目名稱:DPPD-Dental-Clinic-Management-System,代碼行數:10,代碼來源:Data+Validator.cs


注:本文中的System.String.All方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。