-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utils.ts
43 lines (37 loc) · 1.05 KB
/
Utils.ts
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
/**
* Created by Evan on 10/17/2016.
*/
class Utils{
public static isAString(input: string): boolean{
var startMark = input.indexOf("\"");
var endMark = input.lastIndexOf("\"");
/*var newString = input.substring(startMark, endMark);
if(newString.length > 0){
return true;
}
else{
return false;
}*/
if(startMark != endMark){
return true;
}
else{
return false;
}
}
public static replaceAll(str, find, replace): string {
return str.replace(new RegExp(find, 'g'), replace);
}
public static isNormalInteger(str): boolean {
var n = ~~Number(str);
return String(n) === str && n >= 0;
}
public static shaveQuotes(input: string): string{
return input.substring(1, input.length -1);
}
public static getMiddleText(input: string): string{
var startMark = input.indexOf(".");
var endMark = input.lastIndexOf(".");
return input.substring(startMark + 1, endMark);
}
}