当前位置: 首页>>代码示例>>C#>>正文


C# String.equals方法代码示例

本文整理汇总了C#中System.String.equals方法的典型用法代码示例。如果您正苦于以下问题:C# String.equals方法的具体用法?C# String.equals怎么用?C# String.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.String的用法示例。


在下文中一共展示了String.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigFile

        /// <summary>
        /// Locate, open, and parse a library configuration file.
        /// </summary>
        ///
        public ConfigFile()
        {
            this.config_ = new Hashtable<String, String>();
            path_ = findConfigFile();

            if (!path_.equals(""))
                parse();
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:12,代码来源:ConfigFile.cs

示例2: getInstance

 /**
  * Returns the {@code Currency} instance for this currency code.
  * <p>
  *
  * @param currencyCode
  *            the currency code.
  * @return the {@code Currency} instance for this currency code.
  *
  * @throws IllegalArgumentException
  *             if the currency code is not a supported ISO 4217 currency
  *             code.
  */
 public static Currency getInstance(String currencyCode)
 {
     foreach (Locale l in Locale.getAvailableLocales())
     {
         RegionInfo rc = new RegionInfo(l.getCountry());
         if (currencyCode.equals(rc.ISOCurrencySymbol))
         {
             return new Currency(rc);
         }
     }
     throw new java.lang.IllegalArgumentException("currency code is not a supported ISO 4217 currency code");
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:24,代码来源:Currency.cs

示例3: FileHandler

 /**
  * Construct a new {@code FileHandler}. The given name pattern is used as
  * output filename, the maximum file size is set to {@code limit}, the file
  * count is initialized to {@code count} and the append mode is set to
  * {@code append}. The remaining configuration is done using
  * {@code LogManager} properties. This handler is configured to write to a
  * rotating set of count files, when the limit of bytes has been written to
  * one output file, another file will be opened instead.
  *
  * @param pattern
  *            the name pattern for the output file.
  * @param limit
  *            the data amount limit in bytes of one output file, can not be
  *            negative.
  * @param count
  *            the maximum number of files to use, can not be less than one.
  * @param append
  *            the append mode.
  * @throws IOException
  *             if any I/O error occurs.
  * @throws SecurityException
  *             if a security manager exists and it determines that the
  *             caller does not have the required permissions to control this
  *             handler; required permissions include
  *             {@code LogPermission("control")},
  *             {@code FilePermission("write")} etc.
  * @throws IllegalArgumentException
  *             if {@code pattern} is empty, {@code limit < 0} or
  *             {@code count < 1}.
  * @throws NullPointerException
  *             if {@code pattern} is {@code null}.
  */
 public FileHandler(String pattern, int limit, int count, bool append)
 {
     // throws IOException {
     if (pattern.equals("")) { //$NON-NLS-1$
     throw new java.lang.IllegalArgumentException("Pattern cannot be empty"); //$NON-NLS-1$
     }
     if (limit < 0 || count < 1) {
     // logging.1B=The limit and count property must be larger than 0 and
     // 1, respectively
     throw new java.lang.IllegalArgumentException("The limit and count property must be larger than 0 and 1, respectively"); //$NON-NLS-1$
     }
     init(pattern, java.lang.Boolean.valueOf(append), java.lang.Integer.valueOf(limit), java.lang.Integer
         .valueOf(count));
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:46,代码来源:FileHandler.cs

示例4: parse

        /**
         * Parses a level name into a {@code Level} object.
         *
         * @param name
         *            the name of the desired {@code level}, which cannot be
         *            {@code null}.
         * @return the level with the specified name.
         * @throws NullPointerException
         *             if {@code name} is {@code null}.
         * @throws IllegalArgumentException
         *             if {@code name} is not valid.
         */
        public static Level parse(String name)
        {
            //throws IllegalArgumentException {
            if (name == null) {
            // logging.1C=The 'name' parameter is null.
            throw new java.lang.NullPointerException("The 'name' parameter is null."); //$NON-NLS-1$
            }

            bool isNameAnInt;
            int nameAsInt;
            try {
            nameAsInt = java.lang.Integer.parseInt(name);
            isNameAnInt = true;
            } catch (java.lang.NumberFormatException e) {
            nameAsInt = 0;
            isNameAnInt = false;
            }

            lock (levels) {
            foreach (Level level in levels) {
                if (name.equals(level.getName())) {
                    return level;
                }
            }

            if (isNameAnInt) {
                /*
                 * Loop through levels a second time, so that the returned
                 * instance will be passed on the order of construction.
                 */
                foreach (Level level in levels) {
                    if (nameAsInt == level.intValue()) {
                        return level;
                    }
                }
            }
            }

            if (!isNameAnInt) {
            // logging.1D=Cannot parse this name: {0}
            throw new java.lang.IllegalArgumentException("Cannot parse this name: "+ name); //$NON-NLS-1$
            }

            return new Level(name, nameAsInt);
        }
开发者ID:sailesh341,项目名称:JavApi,代码行数:57,代码来源:Level.cs

示例5: init

        private void init(String path, String pathActions)
        {
            if (pathActions == null || pathActions.equals("")) { //$NON-NLS-1$
                throw new java.lang.IllegalArgumentException("actions invalid"); //$NON-NLS-1$
            }
            this.actions = toCanonicalActionString(pathActions);

            if (path == null) {
                throw new java.lang.NullPointerException("path is null"); //$NON-NLS-1$
            }
            if (path.equals("<<ALL FILES>>")) { //$NON-NLS-1$
            includeAll = true;
            } else {
            /*canonPath = AccessController
                    .doPrivileged(new PrivilegedAction<String>() {
                        public String run() {*/
                            try {
                                canonPath = new File(path).getCanonicalPath();
                            } catch (IOException e) {
                                canonPath = path;
                            }/*
                        }
                    });*/
            if (path.equals("*") || path.endsWith(File.separator + "*")) { //$NON-NLS-1$ //$NON-NLS-2$
                allDir = true;
            }
            if (path.equals("-") || path.endsWith(File.separator + "-")) { //$NON-NLS-1$ //$NON-NLS-2$
                allSubdir = true;
            }
            }
        }
开发者ID:sailesh341,项目名称:JavApi,代码行数:31,代码来源:FilePermission.cs

示例6: getService

        /**
         * Returns the service with the specified {@code type} implementing the
         * specified {@code algorithm}, or {@code null} if no such implementation
         * exists.
         * <p/>
         * If two services match the requested type and algorithm, the one added
         * with the {@link #putService(Service)} is returned (as opposed to the one
         * added via {@link #put(Object, Object)}.
         *
         * @param type
         *            the type of the service (for example {@code KeyPairGenerator})
         * @param algorithm
         *            the algorithm name (case insensitive)
         * @return the requested service, or {@code null} if no such implementation
         *         exists
         */
        public Provider.Service getService(String type,
                String algorithm)
        {
            lock (this)
            {
                if (type == null || algorithm == null)
                {
                    throw new java.lang.NullPointerException();
                }

                if (type.equals(lastServiceName)
                        && algorithm.equalsIgnoreCase(lastAlgorithm))
                {
                    return returnedService;
                }

                String alg = algorithm.toUpperCase();
                Object o = null;
                if (serviceTable != null)
                {
                    o = serviceTable.get(type, alg);
                }
                if (o == null && aliasTable != null)
                {
                    o = aliasTable.get(type, alg);
                }
                if (o == null)
                {
                    updatePropertyServiceTable();
                }
                if (o == null && propertyServiceTable != null)
                {
                    o = propertyServiceTable.get(type, alg);
                }
                if (o == null && propertyAliasTable != null)
                {
                    o = propertyAliasTable.get(type, alg);
                }

                if (o != null)
                {
                    lastServiceName = type;
                    lastAlgorithm = algorithm;
                    returnedService = (Provider.Service)o;
                    return returnedService;
                }
                return null;
            }
        }
开发者ID:sailesh341,项目名称:JavApi,代码行数:65,代码来源:Provider.cs

示例7: setFeature

 //throws SAXNotRecognizedException, SAXNotSupportedException
 /**
  * Set a feature flag for the parser.
  *
  * <p>The only features recognized are namespaces and
  * namespace-prefixes.</p>
  *
  * @param name The feature name, as a complete URI.
  * @param value The requested feature value.
  * @exception SAXNotRecognizedException If the feature
  *            can't be assigned or retrieved.
  * @exception SAXNotSupportedException If the feature
  *            can't be assigned that value.
  * @see org.xml.sax.XMLReader#setFeature
  */
 public void setFeature(String name, bool value)
 {
     if (name.equals(NAMESPACES))
     {
         checkNotParsing("feature", name);
         namespaces = value;
         if (!namespaces && !prefixes)
         {
             prefixes = true;
         }
     }
     else if (name.equals(NAMESPACE_PREFIXES))
     {
         checkNotParsing("feature", name);
         prefixes = value;
         if (!prefixes && !namespaces)
         {
             namespaces = true;
         }
     }
     else if (name.equals(XMLNS_URIs))
     {
         checkNotParsing("feature", name);
         uris = value;
     }
     else
     {
         throw new SAXNotRecognizedException("Feature: " + name);
     }
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:45,代码来源:ParserAdapter.cs

示例8: setAssociatedList

 		public void setAssociatedList(String input) {
 			if (input == null)
 				validComponent = false;
 			else if (input.equals("NULL"))
 				associatedList = null;
 			else
 				associatedList = new File(input);
 		}
开发者ID:Crazycolorz5,项目名称:FEEditorSuite2015ProDeluxeEdition,代码行数:8,代码来源:NightmareModule.cs

示例9: getPrefixes

 /**
  * Return anjava.util.Enumeration&lt;Object&gt; of all prefixes for a given URI whose
  * declarations are active in the current context.
  * This includes declarations from parent contexts that have
  * not been overridden.
  *
  * <p/>This method returns prefixes mapped to a specific Namespace
  * URI.  The xml: prefix will be included.  If you want only one
  * prefix that's mapped to the Namespace URI, and you don't care
  * which one you get, use the {@link #getPrefix getPrefix}
  *  method instead.
  *
  * <p/><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
  * in thisjava.util.Enumeration&lt;Object&gt;; to check for the presence of a default
  * Namespace, use the {@link #getURI getURI} method with an
  * argument of "".
  *
  * @param uri The Namespace URI.
  * @return Anjava.util.Enumeration&lt;Object&gt; of prefixes (never empty).
  * @see #getPrefix
  * @see #getDeclaredPrefixes
  * @see #getURI
  */
 public java.util.Enumeration<Object> getPrefixes(String uri)
 {
     java.util.Vector<Object> prefixes = new java.util.Vector<Object>();
     java.util.Enumeration<Object> allPrefixes = getPrefixes();
     while (allPrefixes.hasMoreElements()) {
     String prefix = (String)allPrefixes.nextElement();
     if (uri.equals(getURI(prefix))) {
     prefixes.addElement(prefix);
     }
     }
     return prefixes.elements();
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:35,代码来源:NamespaceSupport.cs

示例10: declarePrefix

 ////////////////////////////////////////////////////////////////////
 // Operations within a context.
 ////////////////////////////////////////////////////////////////////
 /**
  * Declare a Namespace prefix.  All prefixes must be declared
  * before they are referenced.  For example, a SAX driver (parser)
  * would scan an element's attributes
  * in two passes:  first for namespace declarations,
  * then a second pass using {@link #processName processName()} to
  * interpret prefixes against (potentially redefined) prefixes.
  *
  * <p/>This method declares a prefix in the current Namespace
  * context; the prefix will remain in force until this context
  * is popped, unless it is shadowed in a descendant context.
  *
  * <p/>To declare the default element Namespace, use the empty string as
  * the prefix.
  *
  * <p/>Note that you must <em>not</em> declare a prefix after
  * you've pushed and popped another Namespace context, or
  * treated the declarations phase as complete by processing
  * a prefixed name.
  *
  * <p/>Note that there is an asymmetry in this library: {@link
  * #getPrefix getPrefix} will not return the "" prefix,
  * even if you have declared a default element namespace.
  * To check for a default namespace,
  * you have to look it up explicitly using {@link #getURI getURI}.
  * This asymmetry exists to make it easier to look up prefixes
  * for attribute names, where the default prefix is not allowed.
  *
  * @param prefix The prefix to declare, or the empty string to
  *	indicate the default element namespace.  This may never have
  *	the value "xml" or "xmlns".
  * @param uri The Namespace URI to associate with the prefix.
  * @return true if the prefix was legal, false otherwise
  *
  * @see #processName
  * @see #getURI
  * @see #getPrefix
  */
 public bool declarePrefix(String prefix, String uri)
 {
     if (prefix.equals("xml") || prefix.equals("xmlns")) {
     return false;
     } else {
     currentContext.declarePrefix(prefix, uri);
     return true;
     }
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:50,代码来源:NamespaceSupport.cs

示例11: ConfigPolicyManager

        /// <summary>
        /// Create a new ConfigPolicyManager which will act on the rules specified in
        /// the configuration and download unknown certificates when necessary.
        /// </summary>
        ///
        /// <param name="configFileName">separately call load().</param>
        /// <param name="certificateCache">CertificateCache.</param>
        /// <param name="searchDepth"></param>
        /// <param name="graceInterval">public key and the validation time. If omitted, use a default value.</param>
        /// <param name="keyTimestampTtl">value.</param>
        /// <param name="maxTrackedKeys"></param>
        public ConfigPolicyManager(String configFileName,
				CertificateCache certificateCache, int searchDepth,
				double graceInterval, double keyTimestampTtl, int maxTrackedKeys)
        {
            this.certificateCache_ = new CertificateCache();
                    this.maxDepth_ = 5;
                    this.keyGraceInterval_ = 3000;
                    this.keyTimestampTtl_ = 3600000;
                    this.maxTrackedKeys_ = 1000;
                    this.fixedCertificateCache_ = new Hashtable();
                    this.keyTimestamps_ = new Hashtable();
                    this.config_ = new BoostInfoParser();
                    this.requiresVerification_ = true;
                    this.refreshManager_ = new ConfigPolicyManager.TrustAnchorRefreshManager ();
            certificateCache_ = certificateCache;
            maxDepth_ = searchDepth;
            keyGraceInterval_ = graceInterval;
            keyTimestampTtl_ = keyTimestampTtl;
            maxTrackedKeys_ = maxTrackedKeys;

            if (configFileName != null && !configFileName.equals(""))
                load(configFileName);
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:34,代码来源:ConfigPolicyManager.cs

示例12: matchesRelation

        /// <summary>
        /// Determines if a name satisfies the relation to another name, based on
        /// matchRelation.
        /// </summary>
        ///
        /// <param name="name"></param>
        /// <param name="matchName"></param>
        /// <param name="matchRelation">name as a prefix "is-strict-prefix-of" - passes if the name has the other name as a prefix, and is not equal "equal" - passes if the two names are equal</param>
        /// <returns>True if matches.</returns>
        private static bool matchesRelation(Name name, Name matchName,
				String matchRelation)
        {
            bool passed = false;
            if (matchRelation.equals("is-strict-prefix-of")) {
                if (matchName.size() == name.size())
                    passed = false;
                else if (matchName.match(name))
                    passed = true;
            } else if (matchRelation.equals("is-prefix-of")) {
                if (matchName.match(name))
                    passed = true;
            } else if (matchRelation.equals("equal")) {
                if (matchName.equals(name))
                    passed = true;
            }

            return passed;
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:28,代码来源:ConfigPolicyManager.cs

示例13: convertPattern

 protected internal virtual String convertPattern(String template, String fromChars, String toChars,
         bool check)
 {
     if (!check && fromChars.equals(toChars)) {
         return template;
     }
     bool quote = false;
     StringBuilder output = new StringBuilder();
     int length = template.length();
     for (int i = 0; i < length; i++) {
         int index;
         char next = template.charAt(i);
         if (next == '\'') {
             quote = !quote;
         }
         if (!quote && (index = fromChars.indexOf(next)) != -1) {
             output.append(toChars.charAt(index));
         } else if (check
                 && !quote
                 && ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z'))) {
             // text.05=Invalid pattern char {0} in {1}
             throw new java.lang.IllegalArgumentException("Invalid pattern char "+next+" in "+ template); //$NON-NLS-1$
         } else {
             output.append(next);
         }
     }
     if (quote) {
         // text.04=Unterminated quote
         throw new java.lang.IllegalArgumentException("Unterminated quote"); //$NON-NLS-1$
     }
     return output.toString();
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:32,代码来源:Format.cs

示例14: getFeature

 //throws SAXNotRecognizedException, SAXNotSupportedException
 /**
  * Check a parser feature flag.
  *
  * <p>The only features recognized are namespaces and
  * namespace-prefixes.</p>
  *
  * @param name The feature name, as a complete URI.
  * @return The current feature value.
  * @exception SAXNotRecognizedException If the feature
  *            value can't be assigned or retrieved.
  * @exception SAXNotSupportedException If the
  *            feature is not currently readable.
  * @see org.xml.sax.XMLReader#setFeature
  */
 public bool getFeature(String name)
 {
     if (name.equals(NAMESPACES))
     {
         return namespaces;
     }
     else if (name.equals(NAMESPACE_PREFIXES))
     {
         return prefixes;
     }
     else if (name.equals(XMLNS_URIs))
     {
         return uris;
     }
     else
     {
         throw new SAXNotRecognizedException("Feature: " + name);
     }
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:34,代码来源:ParserAdapter.cs

示例15: getProvider

 //throws NoSuchAlgorithmException
 private static java.security.Provider getProvider(String engine, String alg, String mech)
 {
     java.util.Map<String, String> map = new java.util.HashMap<String, String>();
     map.put(engine + "." + alg, "");
     map.put(engine + "." + alg + " " + "MechanismType", mech);
     java.security.Provider[] providers = java.security.Security.getProviders(map);
     if (providers == null) {
     if (mech.equals("DOM")) {
         // look for providers without MechanismType specified
         map.clear();
         map.put(engine + "." + alg, "");
         providers = java.security.Security.getProviders(map);
         if (providers != null) {
             return providers[0];
         }
     }
     throw new java.security.NoSuchAlgorithmException("Algorithm type " + alg +
                                        " not available");
     }
     return providers[0];
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:22,代码来源:TransformService.cs


注:本文中的System.String.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。