1、取字符串的前i个字符

(1)string str1=str.Substring(0,i);

(2)string str1=str.Remove(i,str.Length-i);

2、去掉字符串的前i个字符

string str1=str.Remove(0,i);

string str1=str.SubString(i);

3、从右边开始取i个字符:

string str1=str.SubString(str.Length-i);

string str1=str.Remove(0,str.Length-i);

4、从右边开始去掉i个字符:

string str1=str.Substring(0,str.Length-i);

string str1=str.Remove(str.Length-i,i);

5、

6 、如果字符串中有"abc"则替换成"ABC"
str=str.Replace("abc","ABC"); 7、c#截取字符串最后一个字符的问题!!!!!!!!!!!!!!!!!!!!! str1.Substring(str1.LastIndexOf(",")+1); 8、C# 截取字符串最后一个字符 k = k.Substring(k.Length-1, 1); 9.获取字符串中某个字符后面的字符串 str.Substring(str.IndexOf('.', 0, atr.Length - 1) + 1);

C#常用的字符串操作, 包括截取的更多相关文章

  1. LoadRunner中常用的字符串操作函数

    LoadRunner中常用的字符串操作函数有:                strcpy(destination_string, source_string);               strc ...

  2. PHP开发中常用的字符串操作函数

    1,拼接字符串 拼接字符串是最常用到的字符串操作之一,在PHP中支持三种方式对字符串进行拼接操作,分别是圆点.分隔符{}操作,还有圆点等号.=来进行操作,圆点等号可以把一个比较长的字符串分解为几行进行 ...

  3. Python 字符串操作,截取,长度

    1.字符串操作: 字符串长度: s = "; slen = len(s); 字符串截取: print s[:-:-] #截取,逆序隔1个取一个字符 print s[:-:-] #截取,逆序隔 ...

  4. String字符串操作--切割,截取,替换,查找,比较,去空格.....

    字符串拼接 直接用+号:String a = "I"; String b = "love"; String c = "you";String ...

  5. Python 字符串操作(截取/替换/查找/分割)

    Python 截取字符串使用 变量[头下标:尾下标],就可以截取相应的字符串,其中下标是从0开始算起,可以是正数或负数,下标可以为空表示取到头或尾. # 例1:字符串截取 str = '1234567 ...

  6. matlab常用的字符串操作函数之一

    1,strcat和strvcat strcat:依次横向连接字符串: strvcat:依次纵向连接字符串: 实例1: >>a1='sophia '; >>a2='is a '; ...

  7. C语言中常用的字符串操作函数

    程序开头要声明 #include <string.h> 函数名: stpcpy 功 能: 拷贝一个字符串到另一个 用 法: char *stpcpy(char *destin, char ...

  8. hive常用的字符串操作函数

  9. shell编程常用的截取字符串操作

    1.          常用的字符串操作 1.1.           替换字符串:$ echo ${var/ /_}#支持正怎表达式 / /表示搜索到第一个替换,// /表示搜索到的结果全部替换. ...

随机推荐

  1. On-board diagnostics connector SAE J1962

    http://en.wikipedia.org/wiki/On-board_diagnostics#Standard_interfaces OBD-II diagnostic connector Th ...

  2. A few things to remember while coding in Python.

    A few things to remember while coding in Python. - 17 May 2012 - UPDATE: There has been much discuss ...

  3. 从零开始学android开发-项目重命名

    --修改项目名称 选中项目-[refactor]-[rename] --修改package名称 选中需要重命名的包-[refactor]-[rename] --修改gen下面的名称 打开Android ...

  4. 有趣的动画视图集合:Android View Animations

    Android View Animations这个项目收集了各种有趣的动画效果. 所有效果: Attension Flash, Pulse, RubberBand, Shake, Swing, Wob ...

  5. impdp的一些实际问题解决方法

    之前在http://blog.csdn.net/bisal/article/details/19067515写过一篇关于expdp和impdp的实践的帖子.今天碰到个问题,有些内容没有介绍全,这里再补 ...

  6. 解决Github使用Fastly CDN而导致不能加载网页的方法 转自 沙丘:http://www.enkoo.net/fastly-cdn-in-gifhub.html

    Github现在基本属于“安全”网站,但Github使用fastly.net的CDN服务后,其网站在国内经常不能正常加载网页.github.global.ssl.fastly.net的亚洲IP一般为1 ...

  7. 用komodo建立python开发环境

    配置 在菜单中选择Edit.Preferences. 代码自动完成 更改tab代表的空格数 括号自动关闭和语法检查 interactive shell 中文支持 缩写 点击菜单View.Tabs &a ...

  8. webrtc学习(二): audio_device之opensles

    audio_device是webrtc的音频设备模块.  封装了各个平台的音频设备相关的代码 audio device 在android下封装了两套音频代码. 1. 通过jni调用java的media ...

  9. JSONP 跨域解决办法

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  10. C#中怎么在EXCEL中的单元格中画斜线啊 ??

    Code Snippet 做法: 1,先添加引用COM,找 Excel 2,using Excel = Microsoft.Office.Interop.Excel; 3, 代码 private Ex ...