NSMutableData remove bytes?

后端 未结 4 494
半阙折子戏
半阙折子戏 2021-02-02 09:25

I can add bytes to a NSMutableData instance easily by using the appendData method, however I do not see any similar method for removing data? Am I overlooking somet

4条回答
  •  余生分开走
    2021-02-02 09:46

    Since NSMutableData is toll-free bridged with CFMutableDataRef, you can use the CFDataDeleteBytes() function:

    NSMutableData *data = ...
    CFDataDeleteBytes((CFMutableDataRef)data, CFRangeMake(3, 4));
    

提交回复
热议问题