Coder Social home page Coder Social logo

jwliang1226 / fgreverser Goto Github PK

View Code? Open in Web Editor NEW
25.0 1.0 5.0 144 KB

A Category of NSString used for mutual converting between simplified Chinese and Traditional Chinese.

License: MIT License

Objective-C 98.93% Ruby 1.07%
traditional-chinese simplified-chinese chinese

fgreverser's Introduction

FGReverser


Introduction

A Category of NSString used for mutual converting between simplified Chinese and Traditional Chinese.

Installtion

  • Manual: Download This Project and drag the FGReverser folder into your peroject, do not forget to ensure "copy item if need" being selected.

  • Cocoapods:

pod 'FGReverser', '~> 2.0'

Usage

Just import the header file:import "NSString+FGReverser.h"

Simplfied Chinese to Traditional Chinese, or Traditional Chinese to Simplfied Chinese, Use:

-(NSString *)reverseString;

Example

NSString *sourceString=@"恭喜发财";
NSString *reslutString=[sourceString fg_reversed];
NSLog(@"%@",reslutString);

The result is 恭喜發財

NSString *sourceString=@"恭喜發財";
NSString *reslutString=[sourceString fg_reversed];
NSLog(@"%@",reslutString);

The result is 恭喜发财

Use in Swift

import UIKit
import FGReverser

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        var str = "恭喜发财"
        str = str.fg_reversed()!
        print(str)
        str = str.fg_reversed()!
        print(str)
    }
}

result is:

恭喜發財 恭喜发财

About Me


@CGPoitZero

fgreverser's People

Contributors

insfgg99x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fgreverser's Issues

pod没有引进reverse文件

pod没有引进reverse文件,另外reverse文件加上后缀和格式化压缩一下比较好(可以减少15kb)

还是pod的问题

pod的时候reverse不是直接放在mainBundle下的,而是放在mainBundle下的Frameworks/FGReverser.framework/reverse
可以改为

  • (NSDictionary *)mapper {
    if(!self.reverseMap) {
    NSString *mapPath = [NSBundle.mainBundle pathForResource:@"reverse" ofType:nil];
    if(!mapPath.length){
    mapPath = [NSBundle.mainBundle pathForResource:@"Frameworks/FGReverser.framework/reverse" ofType:nil];
    }
    self.reverseMap = [NSDictionary dictionaryWithContentsOfFile:mapPath];
    }
    return self.reverseMap;
    }

簡繁互轉字典不全

字典檔案對應的繁體有些不大對

譬如:
启 -> 啓 應該是 启 -> 啟
么-> 麽 應該是 么 -> 麼
为-> 爲 應該是 为-> 為
位轉成了莅,應該簡體繁體都是位

諸如此類,我只是列舉幾個

看起來雖然差不多,但是其實如果用某些字體會造成錯誤。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.