当前位置: 首页>>代码示例>>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;未经允许,请勿转载。