常用API

JAVA学习——常用API 上图有误:plulsSeconds 、plusNanos是增加时间系列方法,equals、isBefore、isAfter是判断系列的方法。对比一下DateTimeFormatter和 LocalDateTime。旧的 Date 和 Calendar 也可以用,但是建议用新的API。接下来是如何使用这些新增的API。 阅读详情
常量区字符串(NSString):
initWithFormat (实例方法)

Returns an NSString object initialized by using a given format string as a template into which the remaining argument values are substituted.

- (instancetype)initWithFormat:(NSString *)format, ...

stringWithFormat(类方法)(转换为字符型)

Returns a string created by using a given format string as a template into which the remaining argument values are substituted.

+ (instancetype)stringWithFormat:(NSString *)format,, ...

intValue(字符转为整型)(floatValue, doubleValue)

The integer value of the string. (read-only)        啊不错的风格hi就看了么

@property (readonly) int intValue

stringByAppendString(字符串拼接)

Returns a new string made by appending a given string to the receiver.

- (NSString *)stringByAppendingString:(NSString *)aString

stringByAppendingFormat(字符连接)(参数不同)

Returns a string made by appending to the receiver a string constructed from a given format string and the following arguments.


length(获得字符串长度)
The number of Unicode characters in the receiver. (read-only)

substringToIndex(获取字符串:下标从0开始到给定的下标结束,但不包含给定的下标)
Returns a new string containing the characters of the receiver up to, but not including, the one at a given index.

substringFromIndex(获取字符串:从给定的下标开始到结束,包含给定的下标)
Returns a new string containing the characters of the receiver from the one at a given index to the end.

substringWithRange(获取一定范围内的字符串)

Returns a string object containing the characters of the receiver that lie within a given range.

- (NSString *)substringWithRange:(NSRange)aRange

componentsSeparatedByString(给一个字符,把原字符串分割成字符数组)

Returns an array containing substrings from the receiver that have been divided by a given separator.

- (NSArray *)componentsSeparatedByString:(NSString *)separator

rangeOfString(子串在原串中的第一次出现的范围,输出开始到结束的下标)`

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

- (NSRange)rangeOfString:(NSString *)aString

stringByReplacingOccurrencesOfString:withString:(把字符中所有的某个字符串替换成新的)

Returns a new string in which all occurrences of a target string in the receiver are replaced by another given string.

- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement

hasPrefix:(验证字符串是否以给定的字符串打头)

Returns a Boolean value that indicates whether a given string matches the beginning characters of the receiver.

- (BOOL)hasPrefix:(NSString *)aString

hasSuffix:(验证字符串是否以给定的字符串结尾)

Returns a Boolean value that indicates whether a given string matches the ending characters of the receiver.

- (BOOL)hasSuffix:(NSString *)aString

isEqualToString(判断两个字符串的大小,( compare:-1是升序 0是相等 1是降序)) 

Returns a Boolean value that indicates whether a given string is equal to the receiver using a literal Unicode-based comparison.

- (BOOL)isEqualToString:(NSString *)aString

lowercaseString(全部字符变成小写)

A lowercase representation of the string.

@property (readonly, copy) NSString *lowercaseString

uppercaseString(全部字符变成大写)

An uppercase representation of the string. (read-only)

@property (readonly, copy) NSString *uppercaseString

capitalizedString(字符串的所有的首字符大写)

A capitalized representation of the receiver. (read-only)

@property (readonly, copy) NSString *capitalizedString

可变字符串(NSMutableString):

appendString:(在原字符串后面添加新字符串)

Adds to the end of the receiver the characters of a given string.

- (void)appendString:(NSString *)aString

deleteCharactersInRange:(删除一定范围内的字符串)

Removes from the receiver the characters in a given range.

- (void)deleteCharactersInRange:(NSRange)aRange

insertString:atIndex:(在给定的下标位置添加字符串)
Inserts into the receiver the characters of a given string at a given location.
- (void)insertString:(NSString *)aString atIndex:(NSUInteger)anIndex

replaceCharactersInRange:withString:(给定一个下标范围,用其他字符串替换范围内的字符串)

Replaces the characters from aRange with those in aString.

- (void)replaceCharactersInRange:(NSRange)aRange withString:(NSString *)aString

setString(用其他字符串替换掉原字符串)

Replaces the characters of the receiver with those in a given string.

- (void)setString:(NSString *)aString

创建数组(NSArray)
initWithObjects:(添加数组元素)

Initializes a newly allocated array by placing in it the objects in the argument list.

- (instancetype)initWithObjects:(id)firstObj,,...

count(返回数组元素个数)

Returns the number of objects currently in the array.

- (NSUInteger)count

arrayWithObjects:(类方法添加objects,便利构造器)

Creates and returns an array containing the objects in the argument list.

+ (instancetype)arrayWithObjects:(id)firstObj,,...

objectAtIndex:(返回给定的下标元素)

Returns the object located at the specified index.

- (id)objectAtIndex:(NSUInteger)index

containsObject:(检查一个字符串是否存在数组中)

Returns a Boolean value that indicates whether a given object is present in the array.

- (BOOL)containsObject:(id)anObject

lastObject(获取数组中最后一个元素) (firstObject)

Returns the last object in the array.

- (id)lastObject

indexOfObject(返回元素在数组内的下标)

Returns the lowest index whose corresponding array value is equal to a given object.

- (NSUInteger)indexOfObject:(id)anObject

创建一个可变数组(NSMutableArray)
arrayWithCapacity:(每次可以添加几个对象)

Creates and returns an NSMutableArray object with enough allocated memory to initially hold a given number of objects.

+ (instancetype)arrayWithCapacity:(NSUInteger)numItems


addObject:(在数组的末尾添加给定的元素)

Inserts a given object at the end of the array.

- (void)addObject:(id)anObject

insertObject:atIndex:(在给定的下标处添加元素)

Inserts a given object into the array's contents at a given index.

- (void)insertObject:(id)anObject atIndex:(NSUInteger)index

replaceObjectAtIndex:withObject:(替换给定的下标的元素)

Replaces the object at index with anObject.

- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject

exchangeObjectAtIndex:withObjectAtIndex:(两个下标的元素进行交换)

Exchanges the objects in the array at given indices.

- (void)exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2

removeObjectAtIndex:(移除下标元素)

Removes the object at index .

- (void)removeObjectAtIndex:(NSUInteger)index

把基本类型转成对象类型(NSNumber):
(借助NSNumer类,把基本数据类型转成对象类型, 使用时,再把NSumber对象类型转回基本数据类型(intValue))
numberWithInt:(整型)

Creates and returns an NSNumber object containing a given value, treating it as a signed int.

+ (NSNumber *)numberWithInt:(int)value

创建字典型(NSDictionary)
(一个key只能对应一个value, 一个value可以对应多个key, 字典根据key来索引数据)

initWithObjectsAndKeys:(添加多个键值对)

Initializes a newly allocated dictionary with entries constructed from the specified set of values and keys.

- (instancetype)initWithObjectsAndKeys:(id)firstObject, , ...

dictionaryWithObjects:forKey:(遍历构造器添加键值对)

Creates and returns a dictionary containing a given key and value.

+ (instancetype)dictionaryWithObject:(id)anObject forKey:(id<NSCopying>)aKey

objectForKey:(根据给定键名,查找值)

Returns the value associated with a given key.

- (id)objectForKey:(id)aKey

allKeys(返回所有的键)

Returns a new array containing the dictionary’s keys.

- (NSArray *)allKeys

allValues(返回所有的值)

Returns a new array containing the dictionary’s values.

- (NSArray *)allValues

objectForKey:(返回给定键所对应的值)

Returns the value associated with a given key.

- (id)objectForKey:(id)aKey

allKeysForObject:(给定值,返回包含值的所有的键)

Returns a new array containing the keys corresponding to all occurrences of a given object in the dictionary.

- (NSArray *)allKeysForObject:(id)anObject

创建一个可变字典(NSMutableDictionary)

{
setObject:forKey:(添加一对键值对)

Adds a given key-value pair to the dictionary.

- (void)setObject:(id)anObject forKey:(id < NSCopying >)aKey

setValue:forKey:(键值对)

Invokes setValue:forKey: on each of the set’s members.

- (void)setValue:(id)value forKey:(NSString *)key
}

现在总结他们2者的区别就是:

1, setObject:forkey:中value是不能够为nil的,不然会报错。

setValue:forKey:中value能够为nil,但是当value为nil的时候,会自动调用removeObject:forKey方法

2, setValue:forKey:中key的参数只能够是NSString类型,而setObject:forKey:的可以是任何类型



removeObjectForKey:(给定键删除相对应的值)

Removes a given key and its associated value from the dictionary.

- (void)removeObjectForKey:(id)aKey

removeObjectsForKeys:(删除所有的值)

Removes from the dictionary entries specified by elements in a given array.

- (void)removeObjectsForKeys:(NSArray *)keyArray

removeAllObjects(删除全部)

Empties the dictionary of its entries.

- (void)removeAllObjects

sortedArrayUsingSelector:(排序)

Returns an array that lists the receiving array’s elements in ascending order, as determined by the comparison method specified by a given selector.

- (NSArray *)sortedArrayUsingSelector:(SEL)comparator
return NSOrderedAscending(升序排列)
return NSOrderedSame(相等)
return NSOrderedDescending(降序排列)

集合(NSSet)
(集合具有无序性,唯一性和随机取数据)
setWithObjects:(为集合添加对象)

Creates and returns a set containing the objects in a given argument list.

+ (instancetype)setWithObjects:(id)firstObj, ...

id(通用数据类型)

isKindOfClass:()

Returns a Boolean value that indicates whether the receiver is an instance of given class or an instance of any class that inherits from that class. (required)

- (BOOL)isKindOfClass:(Class)aClass
FFMPEG常用API 最近开始集中学习使用FFMpeg,对一些常用的api有了一个大致的了解,下面做个记录以备忘!FFMPEG处理流程FFMPEG的函数使用成千上万,不容易记住,但是如果知道她的使用流程的话,那就方便记住的多了! 在我理解的流程如下:1.打开并且初始化输入流(AVFormatContext): 数据的来源,来自一个网络流,还是一个文件.... 2.打开并且初始化输出流(AVFormatConte 阅读详情

相关推荐

【java中常用的API】

java中有很多常用的API,它们提供了便捷的使用方法和工具类,让我们来看一看java中常用的API吧。 1.math类: 它包含基本的数字运算方法,如对数、指数、平方根和三角函数等,一般数据类型为double(也有int型) 但是它没有构造方法,有static进行修饰(如果类的成员都是静态的则通过类名就可以直接调用。) math类中的常用方法: math类的常用方法 方法名 说明 public static int abs(int a) 返回参数的绝对值 public st

akisi的博客 7953

iOS学习笔记总结整理

学习IOS开发这对于一个初学者来说,是一件非常挠头的事情。其实学习IOS开发无外乎平时的积累与总结。下面为大家整理了一部分的iOS学习笔记总结整理,希望对大家有所帮助。 一.内存管理情况 1- autorelease,当用户的代码在持续运行时,自动释放池是不会被销毁的,这段时间内用户可以安全地使用自动释放的对象。当用户的代码运行告一段 落,开始等待用户的操作,自动释放池就会被释放掉(调

zky109的专栏 883

FFmpeg —— FFmpeg常用API函数介绍

目录 1.常用API 1.1 通用API 1.1.1 av_register_all()——弃用 1.1.2 内存的分配和释放(av_malloc()、av_free()等) 1.1.3 常见结构体的初始化和销毁(AVFormatContext、AVFrame) 1.1.4 avio_open2() 1.1.5 avcodec_find_encod...

天空的博客 2万+

oc——Foundation框架——字典

NSDictionary的功能与用法 NSDictionary分别提供了类方法和实例方法来创建NSDictionary,类方法以dictionary开头,实例方法则以init开头,下面是创建NSDictionary对象的几类常见的方法: 🎇dictionary:创建一个不包含任何key-value对的NSDictionary。 🎇dictionaryWithContentsOfFile:/initWithContentsOfFile::读取指定文件的内容,使用指定的文件内容来初始化NSDictionar

m0_62386635的博客 520

Java常用类和基础API

获取"ab"在"abkkcadkabkebfkabkskab"中出现的次数。(1)定义用户类,属性为用户名和密码,提供相关的getter和setter方法,构造器,tostring()使用LocalDateTime获取当前时间,把这个时间设置为你的生日,再获取你的百天(出生后100天)日期。使用Calendar获取当前时间,把这个时间设置为你的生日,再获取你的百天(出生后100天)日期。//存储字符串数据的容器。字符串常量池,在不同的jdk版本中,存放位置不同。字符串常量池不允许存放两个相同的字符串常量。

m0_72047169的博客 4万+

大白映射 宝马Esys编程设码映射、USB设备映射

大白映射,宝马Esys设码编程、USB设备映射

denson0394的博客 4795

疯狂iOS学习笔记-字典

NSDictionary集合由多组key-value组成,因此创建NSDictionary时需要同时指定多组key-value对。 NSDICTIONARY分别提供了类方法和实例方法创建NSDictionary。一旦得到NSDictionary对象,接下来就可以通过方法访问该集合所包含的 key或value。下面为NSDictionary扩展一个print类别。 上面的程序示范了NSDictionary的两个基本用法,程序可使用快速枚举来遍历NSDictionary的所有key。也可以根据key来获取对应N

m0_63852285的博客 3221

FreeRTOS实战:如何避免HAL_Delay在高优先级中断中的坑(附TIM6配置指南)

本文深入剖析了在STM32 FreeRTOS项目中,于高优先级中断内调用HAL_Delay函数导致系统假死的根本原因——SysTick时基被FreeRTOS占用且优先级最低。文章提供了治本方案:通过配置TIM6作为独立且最高优先级的HAL时基,实现与FreeRTOS系统心跳的解耦,并附上详细的CubeMX配置与代码移植指南,确保系统实时性与稳定性。

weixin_29230059的博客 64

NSDictionary使用小结

#import int main(int argc, const char * argv[]) { @autoreleasepool { //创建字典 NSDictionary *dic1 = [NSDictionary dictionaryWithObject:@"value" forKey:@"key"]; NSLog(@"di

收破烂的 5万+

基于 YOLO + SAM 的自动图像标注实战

摘要: 本文提出一种基于YOLO检测和SAM分割的自动化数据标注流水线方案,通过YOLO定位目标并生成检测框,再以检测框为提示驱动SAM完成精细分割,最终输出YOLO格式的标注文件。该方案将人工标注升级为半自动流程,显著提升标注效率,尤其适用于多类别、大规模图像的实例级标注需求。代码模块化设计支持模型灵活替换,并集成异常处理与进度可视化功能。虽依赖YOLO检测质量且对小目标存在局限,但作为工程落地方案,可有效降低私有数据集构建成本,适用于工业检测、遥感等场景的冷启动标注。

qq_64366203的博客 1144

衡山派Luban-Lite系统SDIO无线网络配置实战:以D133CBV-QFN88开发板与RTL8189模组为例

本文详细介绍了在衡山派D133CBV-QFN88开发板上,为Luban-Lite系统配置SDIO无线网络的完整实战流程。通过配置SDMC接口、RTL8189 Wi-Fi驱动、lwIP协议栈及内核参数,并解决编译分区问题,最终实现Wi-Fi网络连接与测试,为嵌入式设备联网提供清晰指导。

weixin_35677363的博客 266

黑马程序员——OC中字典的用法总结

------Java培训、Android培训、iOS培训、.Net培训、期待与您交流! ------- NSDictionary:不可变字典 不可变字典:字典对象一旦创建完成后,字典成员不能够被修改,增加和删除 字典的创建//输出字典成员的时候发现字典中成员是无序的并且字典输出时内容放在{}中 NSDictionary *dictionary = @{@"key

woliujialin的专栏 748

大数据实战:Python与MySQL在足球赔率分析中的高效应用

本文详细介绍了如何利用Python与MySQL进行大数据实战,实现足球赔率的高效分析。通过对比Excel处理的局限性,阐述了数据库在处理百万级数据时的速度优势。文章提供了从环境搭建、使用pymysql连接数据库、利用pandas进行数据清洗与分析,到构建自动化分析系统的完整流程,旨在帮助读者将大数据技术应用于实际业务场景,显著提升数据处理与洞察效率。

weixin_29080843的博客 444

Java常用API

别人写好的一些程序,给咱们程序员直接拿去调用。Java官方其实已经给我们写好了很多很多类,每一个类中又提供了一系列方法来解决与这个类相关的问题。比如String类,表示字符串,提供的方法全都是对字符串操作的。比如ArrayList类,表示一个容器,提供的方法都是对容器中的数据进行操作的。1. 我们为什么要学习别人写好的程序呢?在行业中有这么一句话:“不要重复造轮子”。这里所说的轮子就是别人已经写过的程序。

tokisaki_33的博客 1010

14、多级快速多极子算法(MLFMA)详解

多级快速多极子算法(MLFMA)是一种高效加速矩阵向量乘法(MVM)的数值方法,广泛应用于电磁场积分方程求解中。该算法通过构建多级树结构,将MVM分解为近场直接计算和远场分组计算两部分,利用递归聚类、聚合-平移-分解三阶段处理远场相互作用,并结合采样、模式计算与优化策略,将计算复杂度从O(N^2)降低至O(N log N)。博文详细阐述了MLFMA的核心步骤、数学推导、计算复杂度及实际应用中的优化技术,如伽辽金方案改进、对称性利用和反插值方法,为大规模电磁问题的高效求解提供了系统性指导。

t8u9v0w1x的博客 241

Linux 下安装 openjdk 17【详细步骤】

JDK17,安装教程。

甘蓝的专栏 7502

HBase Java常用API

HBase Java常用API 常用API hbase类 功能 org.apache.hadoop.hbase.HBaseConfiguration HBase配置信息。默认的构造方法会尝试从hbase-default.xml和hbase-site.xml中读取配置。 org.apache.hadoop.hbase.client.HBaseAdmin 提供了一个接口来管理HBa...

池边的树的博客 315

推荐一个直接用于项目开发的PID库!很好用,很稳定

关注、星标公众号,不错过精彩内容大家好,我是小麦。最近有朋友问到有没有现成的C语言PID库。当然有了!现在我就准备给大家安利一下了。一般同学会去某度上搜,看到各种各样版本的PID示例,或者...

一名热爱技术的工程师的博客。分享技术干货,记录美好生活。永远相信美好的事情即将发生。 9022

JAVA常用API

Java常用API String、StringBuilder、Math、System、Object、Objects、BigDecimal等

tuoniaoxs的博客 1万+

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

常用的数组API

数组的常用API, 包括 批处理 API

m0_72247725的博客 4092

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

十一、常用 API

本文主要讲解了 API 介绍和文档、包、String 和 ArrayLIst。其中还有几个案例大家可以自己尝试动手操作一下。

fengguu的博客 820

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

java-常用API

别人写好的一些程序,给咱们程序员直接拿去调用。Java官方其实已经给我们写好了很多很多类,每一个类中又提供了一系列方法来解决与这个类相关的问题。比如String类,表示字符串,提供的方法全都是对字符串操作的。比如ArrayList类,表示一个容器,提供的方法都是对容器中的数据进行操作的。像这样的类还有很多,Java把这些类是干什么用的、类中的每一个方法是什么含义,编写成了文档,我们把这个文档称之为API文档。1. 今天我们主要学习两个类,一个是String类、还有一个是ArrayList类。

qq_69149404的博客 922

Java常用API总结

包括基本数据类型的包装类、String类、Object类等。:包括List、Set、Map等。常用的有ArrayList、LinkedList、HashSet、TreeSet、HashMap、TreeMap等。:包括字节流和字符流的API,常用的有InputStream、OutputStream、Reader、Writer等。:包括Socket和ServerSocket等。:包括多线程编程的API,如Thread、Runnable、Executor、Semaphore等。

岛森年的博客 1576

【API】16. 常用API

关于部分常用API的整理。API(Application Programming Interface)是一组为开发人员提供的预定义的类、接口、方法和常量的集合,用于构建Java应用程序。

kuxiaoyang的博客 1418
下一篇: instancetype 和 id 的区别
WMMBK
博客等级 码龄12年 1粉丝 20原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值