亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

NSString_InstanceMethods

發布時間:2020-07-09 06:08:00 來源:網絡 閱讀:282 作者:zhangjiansong0 欄目:開發技術

NSString

Inherits from: NSObject

Conforms to: NSObject, NSMutableCopying, NSSecureCoding, NSCopying


    stringByTrimmingCharactersInSet:

Returns a new string made by removing from both ends of the receiver characters contained in a given character set.

- (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set

Parameters

set

A  character set containing the characters to remove from the receiver. set must not be nil.

Return Value

A new string made by removing from both ends of the receiver characters contained in set. if the receiver is composed entirely of characters from set, the empty string is returned.

Discussion

Use whitespaceCharacterSet or whitespaceAndNewlineCharacterSet to remove whitespace around strings.

    rangeOfString:

Finds and returns the range of the first occurrence of a given string within the receiver.

- (NSRange)rangeOfString:(NSString *)aString

Parameters

aString

The string to search for. This value must not be nil.

Raises an NSInvalidArgumentException if aString is nil.

Return Value

An NSRange structure giving the location and length in the receiver of  the first occurrence of aString. Returns {NSNotFound, 0} if aString is not found or is empty (@“”).

e.g.

NSRange *range = [“http://unpbook.com/small.git” rangeOfString:@“://”];

log:range.location = 4,length = 3

Discussion

Invokes rangeOfString:options: with no options.

    compare:options:

Compares the string with the specified string using the given options.

- (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask

Parameters

aString

The string with which to compare the receiver.

This value must not be nil. If this value is nil, the behavior is undefined and may change in future versions of OS X.

mask

Options for the search—you can combine any of the following using a C bitwise OR operator: NSCaseInsensitiveSearch, NSLiteralSearch, NSNumericSearch. See String Programming Guide for details on these options.

        NSCaseInsensitiveSearch 不區分大小寫

NSLiteralSearch 區分大小寫

NSNumericSearch 只比較字符串的個數,而不比較字符串的字面值

Return Value

The result of invoking compare:options:range: with a given mask as the options and the receiver’s full extent as the range.

Discussion

If you are comparing strings to present to the end-user, you should typically use localizedCompare: or localizedCaseInsensitiveCompare: instead, or use compare:options:range:locale: and pass the user’s locale.

e.g.

    NSString *scheme;

    if ([scheme compare:@"http"] options:NSCaseInsensitiveSearch] == NSOrderedSame) 

additional

    NSComparisonResult
    These constants are used to indicate how items in a request are ordered.
    enum {
   NSOrderedAscending = -1,
   NSOrderedSame,
   NSOrderedDescending
};
typedef NSInteger NSComparisonResult;


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

桐乡市| 西平县| 苏州市| 珠海市| 莒南县| 四川省| 开原市| 拉萨市| 湖口县| 海南省| 安多县| 藁城市| 新巴尔虎左旗| 秦安县| 永泰县| 富顺县| 昌都县| 景洪市| 沅江市| 长沙县| 平舆县| 大连市| 金秀| 抚宁县| 沅江市| 登封市| 会昌县| 林甸县| 呼图壁县| 文山县| 阿荣旗| 靖宇县| 曲沃县| 盐津县| 寿光市| 阳新县| 且末县| 漳浦县| 区。| 康定县| 右玉县|