String类的一些方法
String 类有以下方法:
startsWith(String prefix)
Tests if this string starts with the specified prefix.
- Parameters:
- prefix the prefix.
- Returns:
trueif the character sequence represented by the argument is a prefix of the character sequence represented by this string;falseotherwise. Note also thattruewill be returned if the argument is an empty string or is equal to thisStringobject as determined by theequals(Object)method.- Since:
- 1. 0
- 就是判断字符串中的后缀是否为参数prefix,如果是就返回true,如果不是就返回false。
- 这在安卓中可以用来识别音频文件,如mp3文件等。
- 对应的,还有一个方法,
- endsWith(String suffix)
-
Tests if this string ends with the specified suffix.
- Parameters:
- suffix the suffix.
- Returns:
trueif the character sequence represented by the argument is a
suffix of the character sequence represented by this object;false
otherwise. Note that the result will betrueif the argument is the
empty string or is equal to thisStringobject as determined by the
equals(Object)
method.- 可以用来判断一个字符串是否以suffix这个参数开头。
String类的一些方法的更多相关文章
- 关于JAVA的String类的一些方法
一.得到字符串对象的有关信息 1.通过调用length()方法得到String的长度. String str=”This is a String”; int len =str.length(); 2. ...
- C++ string 类的 find 方法实例详解
1.C++ 中 string 类的 find 方法列表 size_type std::basic_string::find(const basic_string &__str, size_ty ...
- java.lang.String 类的所有方法
java.lang.String 类的所有方法 方法摘要 char charAt(int index) 返回指定索引处的 char 值. int codePointAt(int index) 返回指定 ...
- Java中String类的format方法使用总结
可参考: http://www.cnblogs.com/fsjohnhuang/p/4094777.html http://kgd1120.iteye.com/blog/1293633 String类 ...
- String类的split方法以及StringTokenizer
split方法可以根据指定的表达式regex将一个字符串分割成一个子字符串数组. 它的参数有两种形式,也即:split(String regex)和split(String regex, int li ...
- ASP.Net string 类的扩展方法 [转]
string 类的扩展方法列表(基本相同于 IEnumerable<T> 接口的成员列表): Aggregate<> //累加 All<> / ...
- String类的indexOf方法的用法和举例
2017年3月3号博主第一次去郑州互联网公司面试,背景是这样的我先前去了农大龙子湖校园招聘投简历,然后第二天去面试了那经历可以说是很失败的一次面试,当然这跟自己的水平有关了接下来重点讲一下面试的题目: ...
- Servlet 中为多项选择题判分---String类的indexOf()方法妙用
首先来看一下String类的indexOf()方法的用法: public class FirstDemo1 { /** *API中String的常用方法 */ // 查找指定字符串是否存在 publi ...
- Java字符串的匹配问题,String类的matches方法与Matcher类的matches方法的使用比较,Matcher类的matches()、find()和lookingAt()方法的使用比较
参考网上相关blog,对Java字符串的匹配问题进行了简单的比较和总结,主要对String类的matches方法与Matcher类的matches方法进行了比较. 对Matcher类的matches( ...
随机推荐
- java 多个文件打包zip
/** * 多个文件打包成zip */ public class ZipDemo { private static void create() throws Exception{ String pat ...
- python中3个帮助函数help、dir、type的使用
1.help函数:查看模块.函数.变量的详细说明: 查看模块 help("modules") 查看包 help("json") 查看类 help(json.J ...
- 自己动手写List集合(C#)
平时经常使用微软的List集合,觉得理所应当,这阵子突然意识到学编程学这么久,总不能只生存在某个平台某种语言下面.我觉得要跳出这个框,而数据结构是经常用到的,所以呢,作为一个有志向的程序员应该学会它. ...
- C# 读书笔记之继承与多态
1.1继承与多态的基本概念 1.1.1 继承和多态 继承是面向对象程序设计的主要特征之一,允许重用现有类(基类,亦称超类.父类)去创建新类(子类,亦称派生类)的过程.子类将获取基类的所有非私有数据和行 ...
- 磁珠在PCB中的应用
1.磁珠的单位是欧姆,而不是亨特,这一点要特别注意.因为磁珠的单位是按照它在某一频率产生的阻抗来标称的,阻抗的单位也是欧姆.磁珠的 DATASHEET上一般会提供频率和阻抗的特性曲线图,一般以100M ...
- Windows 8.1 IIS 8.5 远程管理 Windows 2008 R2 IIS 7.0
案例: Windows 8.1 x64 IIS 8.5 inetmgr_amd64_v1.1_en-US.msi Windows 2008 R2 x64 IIS 7.0 在Win8.1 通过IIS ...
- hdu 5269 ZYB loves Xor I(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5269 思路分析:当lowbit(AxorB)=2p 时,表示A与B的二进制表示的0-p-1位相等,第p ...
- jQuery EasyUI 数字框(NumberBox)用法
这里的options是选项,可以参考下表: 选项名 类型 描述 默认值 min 数字 文本框中可允许的最小值 null max 数字 文本框中可允许的最大值 null precision 数字 最高可 ...
- kali linux
1. Kali 2.0使用SSH进行远程登录 http://jingyan.baidu.com/article/eae07827a3e6bc1fec5485e3.html 一.配置SSH参数修改ss ...
- vs 2010 网站项目和asp.net 应用程序引用webservice
项目需要做对接,对方提供的是一个webservice接口,自己建了个网站项目,然后添加web 引用,一切正常. 当实际编码的时候,发现一些类.方法找不到. 百思不得其解,只得对照对方提供的demo 看 ...