-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEoinJSONSuper.swift
More file actions
63 lines (53 loc) · 1.96 KB
/
EoinJSONSuper.swift
File metadata and controls
63 lines (53 loc) · 1.96 KB
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
//
// EoinJSONSuper.swift
// CreateJsonSwiftObjects
//
// Created by Eoin Norris on 08/01/2015.
// Copyright (c) 2015 Eoin Norris. All rights reserved.
//
import Cocoa
public class EoinJSONSuper {
let newLineCreator = EOINNewLineGenerator()
func tab(tabs:Int)->String{
return newLineCreator.generateDefaultTabs(tabs)
}
func tabNL(tabs:Int)->String{
return newLineCreator.generateNewLineAndTab(tabs)
}
func newLine(lines:Int)->String{
return newLineCreator.generateNewLines(lines)
}
func cleanUpArrayType(arrayType:String)->String{
var components = arrayType.componentsSeparatedByString("<");
var result:String = arrayType
if (components.count == 2){
result = components[1];
result = result.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
if result.hasSuffix(">"){
result = result.substringToIndex(result.endIndex.predecessor())
}
}
return result
}
func cleanUpTypeForParamaterization(arrayType:String)->String{
var components = arrayType.componentsSeparatedByString(":");
var result:String = arrayType
if (components.count == 2){
result = components[1];
result = result.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
if result.hasSuffix("?"){
result = result.substringToIndex(result.endIndex.predecessor())
}
}
return result
}
func cleanUpType(arrayType:String)->String{
var components = arrayType.componentsSeparatedByString(":");
var result:String = arrayType
if (components.count == 2){
result = components[1];
result = result.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
}
return result
}
}