NSString - stringByTrimmingCharactersInSet
来源:互联网 发布:大学生网络危害的案例 编辑:程序博客网 时间:2024/05/02 02:02
NSString - stringByTrimmingCharactersInSet:
Returns a new string made by removing from both ends of the receiver characters contained in a given character set.
Declaration
SWIFT
func stringByTrimmingCharactersInSet(_ set: NSCharacterSet) -> String
OBJECTIVE-C
- (NSString * _Nonnull)stringByTrimmingCharactersInSet:(NSCharacterSet * _Nonnull)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.
Availability
Available in iOS 2.0 and later.
去掉字符串前后的空格:
Returns a new string made by removing from both ends of the receiver characters contained in a given character set.
Declaration
SWIFT
func stringByTrimmingCharactersInSet(_ set: NSCharacterSet) -> String
OBJECTIVE-C
- (NSString * _Nonnull)stringByTrimmingCharactersInSet:(NSCharacterSet * _Nonnull)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.
Availability
Available in iOS 2.0 and later.
去掉字符串前后的空格:
NSString *newString = [oldString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
0 0
- NSString - stringByTrimmingCharactersInSet
- NSString 的stringByTrimmingCharactersInSet使用
- iOS: NSString的方法stringByTrimmingCharactersInSet:
- NSCharacterSet stringByTrimmingCharactersInSet
- NSCharacterSet stringByTrimmingCharactersInSet
- whitespaceAndNewlineCharacterSet stringByTrimmingCharactersInSet
- NSArrayM stringByTrimmingCharactersInSet
- NSString
- NSSTring
- NSString
- NSString
- NSString
- NSString
- nsstring
- NSString
- NSString
- NSString
- NSString
- Valid Sudoku and Sudoku Solver
- iOS网络通信类库
- Apache2 httpd.conf 配置详解 (二)
- 解决视图状态消息验证代码 (MAC) 错误
- 利用ViewPager实现app的启动画面
- NSString - stringByTrimmingCharactersInSet
- CentOS下MySQL两种安装方式
- 比赛1
- 常见加载类错误分析ClassNotFoundException和NoClassDefFoundError
- Lua 入门学习
- OS开发网络篇—HTTP协议i
- sqlserver The system cannot find the file specified
- C# WPF 中用代码模拟鼠标和键盘的操作
- android错误:Installation error: INSTALL_FAILED_VERSION_DOWNGRADE