public bool Contains(string value)
如果值参数出现在此字符串内,或者值为空字符串(“”),则为true; 否则为false
using System;

class Example
{
public static void Main()
{
string s1 = "The quick brown fox jumps over the lazy dog";
string s2 = "fox";
bool b = s1.Contains(s2);
Console.WriteLine("'{0}' is in the string '{1}': {2}",
s2, s1, b);
if (b) {
int index = s1.IndexOf(s2);
if (index >= )
Console.WriteLine("'{0} begins at character position {1}",
s2, index + );
}
}
}
// This example display the following output:
// 'fox' is in the string 'The quick brown fox jumps over the lazy dog': True
// 'fox begins at character position 17

string函数Contains()实例的更多相关文章

  1. Python 常用string函数

    Python 常用string函数 字符串中字符大小写的变换 1. str.lower()   //小写>>> 'SkatE'.lower()'skate' 2. str.upper ...

  2. string函数分析

    string函数分析string函数包含在string.c文件中,经常被C文件使用.1. strcpy函数原型: char* strcpy(char* str1,char* str2);函数功能: 把 ...

  3. PHP String 函数

    [http://www.w3school.com.cn/php/php_ref_string.asp ] PHP String 简介 String 字符串函数允许您对字符串进行操作. 安装 Strin ...

  4. lua string函数

    lua的string函数: 参数中的index从1开始,负数的意义是从后开始往前数,比如-1代表最后一个字母 对于string类型的值,可以使用OO的方式处理,如string.byte(s.i)可以被 ...

  5. PHP 5 String 函数

    PHP 5 String 函数 PHP String 函数是 PHP 核心的组成部分.无需安装即可使用这些函数. 函数 描述 addcslashes() 返回在指定的字符前添加反斜杠的字符串. add ...

  6. c++string函数详解

    string,一个极为好用了函数,学好了这些函数,在模拟以及字符串问题上,回节省很多很多的写代码时间,代码复杂度以及错误率,那么这一类函数都有那些功能呢?我们来逐一介绍(让你大吃一惊,还有这种操作?) ...

  7. SQL中的函数以及实例

    AVG (平均) COUNT (计数) MAX (最大值) MIN (最小值) SUM (总合) 运用函数的语法是: selecte  "函数名"("列名") ...

  8. Javascript时间差计算函数代码实例

    Javascript时间差计算函数代码实例 <script language="javascript"> Date.prototype.dateDiff = funct ...

  9. 常用string函数分析

    string函数分析string函数包含在string.c文件中,经常被C文件使用.1. strcpy函数原型: char* strcpy(char* str1,char* str2);函数功能: 把 ...

随机推荐

  1. union和struct的区别之处,在于内存的共享上

    首先看看union,在c++中,union可能没有多大用处,在c语言中,可能我们要借助其完成很多巧妙的设计,下面是其一个完整的定义: union UTest         {             ...

  2. vs2008使用mysql链接错误

    原因是因为安装了64位的mysql,而开发工具室32位的,需要安装32位的开发库就可以了

  3. 2017.10.28 针对Java Web应用中错误异常处理方法的运用

    针对Java Web应用中错误异常处理方法的运用 在javaweb中其异常都需要对Checked Exception之下的Exception进行继承,并且有选择地对发生的错误和异常进行处理.Java同 ...

  4. 几位it 前辈的博客

    赵劼 http://blog.zhaojie.me/?page=2 陈硕 http://www.cnblogs.com/Solstice/ 轮子哥 http://www.cnblogs.com/gen ...

  5. powerdesigner15 反向工程

  6. Eclipse 修改默认工作空间

    第一次启动Eclipse时会弹出对话框,让你进行Workspace Launcher,也就是设置Eclipse的项目存放路径.但是,当你勾选“Use this as the default and d ...

  7. 1、SpringBoot+Mybatis整合------简单CRUD的实现

    编译工具:STS 代码下载链接:https://github.com/theIndoorTrain/SpringBoot_Mybatis01/commit/b757cd9bfa4e2de551b2e9 ...

  8. java mysql多次事务 模拟依据汇率转账,并存储转账信息 分层完成 dao层 service 层 client层 连接池使用C3p0 写入库使用DBUtils

    Jar包使用,及层的划分 c3p0-config.xml <?xml version="1.0" encoding="UTF-8"?> <c3 ...

  9. javaWeb CSS 图像签名

    <html> <head> <meta charset="utf-8" /> <title>CSS布局之图像签名</title ...

  10. DB总结1

    DBA  重构 data  new york   committee   cobol codasyl  journal DDL  DML    关系演算  域关系演算语言(QBE)  元祖关系演算语言 ...