File: MWTAMSStringCategories.m

package info (click to toggle)
gtamsanalyzer.app 0.42-6
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 6,112 kB
  • ctags: 866
  • sloc: objc: 34,338; ansic: 8,762; cpp: 384; makefile: 59; sh: 47
file content (68 lines) | stat: -rwxr-xr-x 1,426 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
//  MWTAMSStringCategories.m
//  avtams
//
//  Created by matthew on Sun Mar 21 2004.
//  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
//

#import "MWTAMSStringCategories.h"


@implementation NSString(MWTAMSStringCategories)
-(NSString *) copyrelease
{
    return [[self copy] autorelease];
}

-(int) numberOfCodeComponents
{
    return [[self codeComponents] count];
}

-(NSString *) lastCodeComponents: (int) cnt
{
    NSArray *myComponents;
    int n;
    myComponents = [self codeComponents];
    n = [myComponents count];
    if(cnt < n)
    {
        NSArray *myNewSelf;
        myNewSelf = [myComponents subarrayWithRange: NSMakeRange(n - cnt, cnt)];
        return [myNewSelf componentsJoinedByString: @">"];
    }
    else return [self copyrelease];
}

-(NSString *) lastCodeComponent
{
    return [self lastCodeComponents: 1];
}

-(NSString *) firstCodeComponents: (int) cnt
{
    NSArray *myComponents;
    int n;
    myComponents = [self codeComponents];
    n = [myComponents count];
    
    if(cnt < n)
    {
        NSArray *myNewSelf;
        myNewSelf = [myComponents subarrayWithRange: NSMakeRange(0, cnt)];
        return [myNewSelf componentsJoinedByString: @">"];
    }
    else return [self copyrelease];
}    
    
-(NSString *) firstCodeComponent
{
    return [self firstCodeComponents: 1];
}
-(NSArray *) codeComponents
{
    return [self componentsSeparatedByString: @">"];
}

@end