Repository navigation
Searching, Comparing, and Sorting Strings
binism edited this page Mar 16, 2016
·
11 revisions
字符串对象提供了多种查找字符或者子串、字符串之间的比较方法。这些方法一直按照Unicode标准来判断两个字符序列是否是等价的。字符串类提供比较方法,这些方法能够妥善处理字符序列的组成,当然,如果效率十分重要的情况下,你也可以选择指定的字面搜索。(The string classes provide comparison methods that handle composed character sequences properly, though you do have the option of specifying a literal search when efficiency is important and you can guarantee some canonical form for composed character sequences.)
(字符串)查找和比较有很多不同变体。最简单的一种是对整个字符串进行查找和比较。其它变型允许你改变方式来对字符序列的执行比较,并进行搜索或比较字符串中特定范围指定的字符; (Other variants allow you to alter the way comparison of composed character sequences is performed and to specify a specific range of characters within a string to be searched or compared; )在给定的(编码)环境下,也能进行字符串查找和比较。
这里是一些基本的查找和比较方式:
- Introduction
- Strings
- Creating and Converting String Objects
- Formatting String Objects
- String Format Specifiers
- Reading Strings From and Writing Strings To Files and URLs
- Searching, Comparing, and Sorting Strings
- Words, Paragraphs, and Line Breaks
- Characters and Grapheme Clusters
- Character Sets
- Scanners
- String Representations of File Paths
- Drawing Strings
- Document Revision History
- Index