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


C# String.EndsWith方法代码示例

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


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

示例1: Match

	// Determine if we have an application directory match.
	private static bool Match(UrlParser url, String dir)
			{
				if(dir.EndsWith("/"))
				{
					dir = dir + "*";
				}
				else
				{
					dir = dir + "/*";
				}
				UrlParser parser = new UrlParser(dir);
				return parser.Matches(url);
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:14,代码来源:ApplicationDirectoryMembershipCondition.cs

示例2: Parse

	// Parse a value into an instance of this class.
	public static DateTime Parse(String value)
			{
				if(value == null)
				{
					return DateTime.MinValue;
				}
				else if(value.EndsWith("Z"))
				{
					value = value.Substring(0, value.Length - 1) + "-00:00";
				}
				try
				{
					return DateTime.ParseExact
						(value, formats, CultureInfo.InvariantCulture,
					 	 DateTimeStyles.None);
				}
				catch(Exception)
				{
					throw new RemotingException(_("Arg_InvalidSoapValue"));
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:22,代码来源:SoapDateTime.cs

示例3: Write

    internal void Write(String str)
    {
      ASCIIEncoding m_enc = new ASCIIEncoding();
      byte[] m_buf = new byte[1024];

      if (!str.EndsWith("\r\n")) str += "\r\n";

      m_buf = m_enc.GetBytes(str);

      m_stream.Write(m_buf, 0, m_buf.Length);
    }
开发者ID:balmeidaarruda,项目名称:System.Net.Pop3,代码行数:11,代码来源:Pop3Client.cs

示例4: GetDirName

        private static String GetDirName(String fullPath)
        {
            Debug.Assert(fullPath != null);

            String dirName = null;
            if (fullPath.Length > 3)
            {
                String s = fullPath;
                if (fullPath.EndsWith(Path.DirectorySeparatorChar))
                {
                    s = fullPath.Substring(0, fullPath.Length - 1);
                }
                dirName = Path.GetFileName(s);
            }
            else
            {
                dirName = fullPath;  // For rooted paths, like "c:\"
            }
            return dirName;
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:20,代码来源:DirectoryInfo.cs

示例5: Write

		private void Write(String str)
		{
			ASCIIEncoding encoding = new ASCIIEncoding();

			if (!str.EndsWith("\r\n")) str += "\r\n";

			byte[] bufferBytes = encoding.GetBytes(str);

			_stream.Write(bufferBytes, 0, bufferBytes.Length);
		}
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:10,代码来源:SmtpClient.cs

示例6: IsSuffix

        ////////////////////////////////////////////////////////////////////////
        //
        //  IsSuffix
        //
        //  Determines whether suffix is a suffix of string.  If suffix equals
        //  String.Empty, true is returned.
        //
        ////////////////////////////////////////////////////////////////////////
        public unsafe virtual bool IsSuffix(String source, String suffix, CompareOptions options)
        {
            if (source == null || suffix == null)
            {
                throw new ArgumentNullException((source == null ? nameof(source) : nameof(suffix)),
                    SR.ArgumentNull_String);
            }
            Contract.EndContractBlock();

            if (suffix.Length == 0)
            {
                return (true);
            }

            if (source.Length == 0)
            {
                return false;
            }

            if (options == CompareOptions.OrdinalIgnoreCase)
            {
                return source.EndsWith(suffix, StringComparison.OrdinalIgnoreCase);
            }

            if (options == CompareOptions.Ordinal)
            {
                return source.EndsWith(suffix, StringComparison.Ordinal);
            }

            if ((options & ValidIndexMaskOffFlags) != 0)
            {
                throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
            }

            return EndsWith(source, suffix, options);
        }
开发者ID:stephentoub,项目名称:corert,代码行数:44,代码来源:CompareInfo.cs

示例7:

	// Determine if a SOAP action is valid for a method.
	public static bool IsSoapActionValidForMethodBase
				(String soapAction, MethodBase mb)
			{
				SoapMethodAttribute mattr;
				int index, index2;
				String typeName;
				String mbTypeName;
				String assembly;
				bool hasAssembly;

				// Remove quotes from the action name.
				if(soapAction[0] == '"' && soapAction.EndsWith("\""))
				{
					soapAction = soapAction.Substring
						(1, soapAction.Length - 2);
				}

				// If the action matches the attribute, then return true.
				mattr = (SoapMethodAttribute)
					InternalRemotingServices.GetCachedSoapAttribute(mb);
				if(mattr.SoapAction == soapAction)
				{
					return true;
				}

				// Determine if the action matches the one registered
				// with the method.
				lock(typeof(SoapServices))
				{
					if(methodToAction != null)
					{
						String temp = (String)(methodToAction[mb]);
						if(temp != null && temp == soapAction)
						{
							return true;
						}
					}
				}

				// Pull apart the action and check its components.
				index = soapAction.IndexOf('#');
				if(index != -1)
				{
					typeName = ExtractTypeName
						(soapAction.Substring(0, index), out hasAssembly);
					if(typeName != null)
					{
						if(hasAssembly)
						{
							assembly = mb.DeclaringType.Module
								.Assembly.FullName;
							index2 = assembly.IndexOf(',');
							if(index2 != -1)
							{
								assembly = assembly.Substring(0, index2);
							}
							mbTypeName = mb.DeclaringType.FullName +
								", " + assembly;
						}
						else
						{
							mbTypeName = mb.DeclaringType.FullName;
						}
						if(typeName == mbTypeName)
						{
							return (mb.Name == soapAction.Substring(index + 1));
						}
					}
				}

				// The action string is not valid.
				return false;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:74,代码来源:SoapServices.cs

示例8: Parse

	// Parse a value into an instance of this class.
	public static SoapTime Parse(String value)
			{
				if(value != null && value.EndsWith("Z"))
				{
					value = value.Substring(0, value.Length - 1) + "-00:00";
				}
				return new SoapTime(DateTime.ParseExact
					(value, formats, CultureInfo.InvariantCulture,
					 DateTimeStyles.None));
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:SoapTime.cs


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