Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 20, 2022. It is now read-only.

WangGuibin/lz-string-objc

Open more actions menu

Repository files navigation

lz-string-objc

CI Status Version License Platform

Introduce

站在巨人的肩膀上造轮子 https://github.com/pieroxy/lz-string 一个js压缩库 本轮子只是为了OC方便调用的问题,通过js去调用lz-string.js的接口

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

    #import <LZStringObjc.h>

    LZStringObjc *LZ = [LZStringObjc sharedInstance];
    //base64
    NSLog(@"%@",[LZ compressToBase64:@"hello"]);
    NSLog(@"%@",[LZ decompressFromBase64:@"BYUwNmD2Q==="]);
    
    //utf16
    NSLog(@"%@",[LZ compressToUTF16:@"hello"]);
    NSLog(@"%@",[LZ decompressFromUTF16:@"ˢ䰭䰾搠"]);
    
    //unit8
    NSLog(@"%@",[LZ compressToUint8Array:@"hello"]);
    NSString *str = @"55,129,176,166,7,96,230,2,224,22,0,32,47,2,10,192,26,4,8,192,158,51,0,206,200,32,3,0,30,1,176,1,193,106,20,12,96,197,1,152,11,228,0,0";
    NSArray *strArr = [str componentsSeparatedByString:@","];
    NSLog(@"%@",[LZ decompressFromUint8Array:strArr]);
    
    //uri
    NSLog(@"%@",[LZ compressToEncodedURIComponent:@"hello"]);
    NSLog(@"%@",[LZ decompressFromEncodedURIComponent:@"BYUwNmD2Q"]);

Requirements

Installation

lz-string-objc is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'lz-string-objc'

Author

CoderWGB, 864562082@qq.com

License

lz-string-objc is available under the MIT license. See the LICENSE file for more info.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.