C#的SubString(int start,int end);
C#的SubString();
例子:
string str = "i am a girl";
string temp = str.Substring(2,2);//从索引2开始,截取长度为2的字符串(索引的起始下表是0)
//结果是 am
注意:截取的长度不能比剩下的字符串还要长,否则会报错:
Substring: index and length must refer to a location within the string
错误的原因是超出了字符串的长度,如上面的例子:string temp = str.Substring(2,);//这样就会报错
C#的SubString(int start,int end);的更多相关文章
- c#的中英文混合字符串截取 public static string SubString(string inputString, int byteLength)
/// <summary> /// c#的中英文混合字符串截取(区分中英文) /// </summary> /// <param ...
- String substring(int start,int end)截取当前字符串中指定范围内的字符串
package seday01;/** * String substring(int start,int end) * 截取当前字符串中指定范围内的字符串. * java api有一个特点:通常用两个 ...
- 如何将 select top 4 id from table1 赋值 给 declare @id1 int,@id2 int,@id3 int,@id4 int
declare @id1 int,@id2 int,@id3 int,@id4 int ),) select @sickcode = sickcode,@sfrq =sfrq from tablena ...
- int main( int argc, char **argv)
1.参数 (有时参数是void) argc是程序运行时参数个数 argv是存储参数的数组,可以用char* argv[],也可以用char **argv. 例如编译一个hello.c的程序 1 #in ...
- C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别
转自:http://www.cnblogs.com/leolis/p/3968943.html 在编程过程中,数据转换是经常要用到的,C#中数据转换的方法很多,拿将目标对象转换为 整型(int)来讲, ...
- int(*f)(int)
int(*f)(int): 为指向函数的指针变量的定义方法,其中f为指向函数的指针变量,第一个int为函数返回值类型,第二个int为函数的形参类型.
- what is difference in (int)a,(int&)a,&a,int(&a) ?
This interview question come from a famous communication firm of china. : ) #include <iostream> ...
- C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别 <转>
作者:Statmoon 出处:http://leolis.cnblogs.com/ 在编程过程中,数据转换是经常要用到的,C#中数据转换的方法很多,拿将目标对象转换为整型(int)来讲,有四种方法 ...
- the difference between const int *, int * const, int const *
Some people may be confused about the sequence of const and * on declaration in C++/C, me too. Now I ...
- (int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别
C#中(int).int.Parse().int.TryParse()和Convert.ToInt32()的区别 原文链接:http://www.cnblogs.com/leolis/p/3968 ...
随机推荐
- Excel 帮助无法正常工作的解决方法
Excel 中出现错误:帮助无法正常工作,但您仍可以转到 Office.com,以获得最新和最好的文章.视频和培训课程. 英文消息:Help isn't working, but you can st ...
- Eclipse ADT 与VS 常用的快捷键 对比学习
注:以下说的类型于VS,是指:VS+Resharper的快捷键,我是采用了Resharper作为VS的快捷键. 导航 Ctrl+1 快速修复 (类似于VS的alt+enter) Ctrl+D: 删除当 ...
- Spring Boot 应用系列 4 -- Spring Boot 2 整合log4j2
一.背景 1. log4j2传承于log4j和logback,它是目前性能最好的日志处理工具,有关它们的性能对比请看: 2. 除了性能好之外,log4j2有这么几个重要的新features: (1) ...
- 在TFS持续集成(持续发布)中执行Telnet任务
Telnet是一种在因特网或局域网上使用虚拟终端连接,提供双向交互式文本通信设备的协议. 它是最早的互联网通讯协议之一.自1969年启用以来,已经经过了将近50年时间,在开放式的操作系统中拥有广泛的用 ...
- VS2017 无法使用"XXX"附加到应用程序
可能是启用了腾讯的网游,可以关闭游戏,再试一下,如果还是不行,重启一下就可以了.好像是游戏的什么防篡改的作用
- Sql语法高级应用之七:如何在存储过程中使用事务
普通事物: USE Wot_Inventory; GO BEGIN TRANSACTION tr; DECLARE @error INT; SET @error = 0; SELECT * FROM ...
- 《JavaScript》高级程序设计第7章 函数表达式
7.2 闭包 定义: 闭包是指有权访问另一个函数作用域中的变量的函数. 理解闭包: 作用域链: 当某个函数被调用时,会创建一个执行环境以及相应的作用域链. 作用域链中,外部函数的活动对象始终处于第二位 ...
- eclipse的使用和断点调试
断点: 快捷键 f5: step into f6: step over 跳过,跳到下一行 f7:step return 从某个方法里跳回 跳出 drop to frame: 跳到当前方法的第一行 re ...
- Django思维导图
- 深入学习c++--智能指针(一) shared_ptr
1. 几种智能指针 1. auto_ptr: c++11中推荐不使用他 2. shared_ptr: 每添加一次引用 就+1,减少一次引用,就-1:做到指针进行共享 3. unique_ptr: 一个 ...