no message

This commit is contained in:
giuseppenuc committed 2015-07-08 18:48:28 +02:00
1 parent 5d6efc6d8f
commit 893f7dc183
4 files changed
+147 -2

No files matched your search

@@ -21,6 +21,8 @@
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
6840FB121B4D8245009724FE /* CodFis+Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = 6840FB101B4D8245009724FE /* CodFis+Helper.m */; };
6840FB131B4D8245009724FE /* codFisCodes.json in Resources */ = {isa = PBXBuildFile; fileRef = 6840FB111B4D8245009724FE /* codFisCodes.json */; };
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
91AC20C3FDDAB28D136716A5 /* Pods_CodFis_Helper_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 522AA81E364FC60CEA095D19 /* Pods_CodFis_Helper_Example.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
/* End PBXBuildFile section */
@@ -61,6 +63,9 @@
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
6840FB021B4D78B5009724FE /* CodFisResources.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CodFisResources.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
6840FB051B4D78B5009724FE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6840FB0F1B4D8245009724FE /* CodFis+Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "CodFis+Helper.h"; path = "../../Pod/Classes/CodFis+Helper.h"; sourceTree = "<group>"; };
6840FB101B4D8245009724FE /* CodFis+Helper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "CodFis+Helper.m"; path = "../../Pod/Classes/CodFis+Helper.m"; sourceTree = "<group>"; };
6840FB111B4D8245009724FE /* codFisCodes.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = codFisCodes.json; path = ../../Pod/Classes/codFisCodes.json; sourceTree = "<group>"; };
69D594011BE85121E72B1E7C /* CodFis-Helper.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = "CodFis-Helper.podspec"; path = "../CodFis-Helper.podspec"; sourceTree = "<group>"; };
72426C36BAE7F3E98B267A8F /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
@@ -141,6 +146,7 @@
6003F593195388D20070C39A /* Example for CodFis-Helper */ = {
isa = PBXGroup;
children = (
6840FB091B4D81CF009724FE /* CodFis-Helper */,
6003F59C195388D20070C39A /* CodFisHelperAppDelegate.h */,
6003F59D195388D20070C39A /* CodFisHelperAppDelegate.m */,
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
@@ -209,6 +215,16 @@
name = "Supporting Files";
sourceTree = "<group>";
};
6840FB091B4D81CF009724FE /* CodFis-Helper */ = {
isa = PBXGroup;
children = (
6840FB0F1B4D8245009724FE /* CodFis+Helper.h */,
6840FB101B4D8245009724FE /* CodFis+Helper.m */,
6840FB111B4D8245009724FE /* codFisCodes.json */,
);
name = "CodFis-Helper";
sourceTree = "<group>";
};
83535D2711874F2FBE325BE0 /* Pods */ = {
isa = PBXGroup;
children = (
@@ -326,6 +342,7 @@
files = (
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */,
6003F5A9195388D20070C39A /* Images.xcassets in Resources */,
6840FB131B4D8245009724FE /* codFisCodes.json in Resources */,
6003F598195388D20070C39A /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -446,6 +463,7 @@
buildActionMask = 2147483647;
files = (
6003F59E195388D20070C39A /* CodFisHelperAppDelegate.m in Sources */,
6840FB121B4D8245009724FE /* CodFis+Helper.m in Sources */,
6003F5A7195388D20070C39A /* CodFisHelperViewController.m in Sources */,
6003F59A195388D20070C39A /* main.m in Sources */,
);
@@ -7,12 +7,22 @@
//
#import "CodFisHelperAppDelegate.h"
#import "CodFis+Helper.h"
@implementation CodFisHelperAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
CodFis_Helper *helper = [[CodFis_Helper alloc] init];
[helper setSurname:@"Nucifora"];
[helper setName:@"Giuseppe Emanuel"];
NSLog(@"%@",[helper calculate]);
return YES;
}
-1
View File
@@ -20,7 +20,6 @@ typedef enum {
Gender_Man
} Gender;
@property (nonatomic, strong) NSString *surname;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *birthDay;
+119 -1
View File
@@ -8,6 +8,9 @@
#import "CodFis+Helper.h"
#define DEF_SURNAME_COD_LENGHT 3
#define DEF_NAME_COD_LENGHT 3
@implementation CodFis_Helper
- (instancetype) init {
@@ -19,11 +22,126 @@
}
- (NSString*) calculate {
return @"";
NSMutableString *resposeString = [[NSMutableString alloc] init];
[resposeString appendString:[self getCodFisSurname]];
[resposeString appendString:[self getCodFisName]];
return resposeString;
}
- (BOOL) check:(NSString*) codFis {
return YES;
}
- (NSString *) getCodFisSurname {
NSMutableString *resultString = [[NSMutableString alloc] init];
NSString *vowels = @"aeiouàèìòùáéíóúäëïöü";
NSString *chars = @"qwrtypsdfghjklzxcvbnm";
NSArray* consonantsArray = [[_surname lowercaseString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:vowels]];
NSArray* vowelArray = [[_surname lowercaseString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:chars]];
for (NSString *chr in consonantsArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
return [[resultString substringToIndex:DEF_SURNAME_COD_LENGHT] uppercaseString];
}
for (NSString *chr in vowelArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
[resultString setString:[resultString substringToIndex:DEF_SURNAME_COD_LENGHT]];
}
else {
for(NSUInteger i = [resultString length]; i< DEF_SURNAME_COD_LENGHT;i++){
[resultString appendString:@"x"];
}
}
return [resultString uppercaseString];
}
- (NSString *) getCodFisName {
NSMutableString *resultString = [[NSMutableString alloc] init];
NSString *vowels = @"aeiouàèìòùáéíóúäëïöü";
NSString *chars = @"qwrtypsdfghjklzxcvbnm";
NSMutableArray* consonantsArray = [NSMutableArray arrayWithArray:[[_name lowercaseString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:vowels]]];
NSArray* vowelArray = [NSMutableArray arrayWithArray:[[_name lowercaseString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:chars]]];
for (NSString *chr in [consonantsArray mutableCopy]) {
if ([chr isEqualToString:@""]) {
[consonantsArray removeObject:chr];
}
}
if ([consonantsArray count] > DEF_NAME_COD_LENGHT) {
[resultString appendString:[consonantsArray objectAtIndex:0]];
[resultString appendString:[consonantsArray objectAtIndex:2]];
[resultString appendString:[consonantsArray objectAtIndex:3]];
}
else {
for (NSString *chr in consonantsArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
return [[resultString substringToIndex:DEF_SURNAME_COD_LENGHT] uppercaseString];
}
for (NSString *chr in vowelArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
[resultString setString:[resultString substringToIndex:DEF_SURNAME_COD_LENGHT]];
}
else {
for(NSUInteger i = [resultString length]; i< DEF_SURNAME_COD_LENGHT;i++){
[resultString appendString:@"x"];
}
}
}
/*for (NSString *chr in consonantsArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
return [[resultString substringToIndex:DEF_SURNAME_COD_LENGHT] uppercaseString];
}
for (NSString *chr in vowelArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] >= DEF_SURNAME_COD_LENGHT) {
[resultString setString:[resultString substringToIndex:DEF_SURNAME_COD_LENGHT]];
}
else {
for(NSUInteger i = [resultString length]; i< DEF_SURNAME_COD_LENGHT;i++){
[resultString appendString:@"x"];
}
}*/
return [resultString uppercaseString];
}
@end