-
Notifications
You must be signed in to change notification settings - Fork 0
/
String.m
119 lines (91 loc) · 1.69 KB
/
String.m
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
%
% An Object-Oriented approach to Matlab strings
%
classdef String
properties (Hidden)
value;
end
properties (SetAccess = private)
end
events
end
methods
% Constructor
function this = String(value)
% if class(value) == char, this.value = value; end
this.value = value;
end
% split the string at 'delimiter'
% @param { string } 'delimiter' - the delimiter
function matches = split(this,delimiter)
matches = textscan(this.value,'%s','delimiter',delimiter);
matches = matches{1,:};
end
%
function charAt(this)
end
%
function charCodeAt(this)
end
%
function concat(this)
end
%
function format(this)
end
%
function fromCharCode()
end
%
function indexOf()
end
%
function lastIndexOf()
end
%
function localeCompare()
end
%
function match()
end
%
function replace()
end
%
function search()
end
%
function slice()
end
%
function substr()
end
%
function toLocaleLowerCase()
end
%
function toLocaleUpperCase
end
% convert the string to lowercase
% NOTE: does not modify this object
% @return { String } this - the value of this String object converted to lowercase
function this = lower(this)
this.value = lower(this.value);
end
% convert the string to uppercase
% NOTE: does not modify this object
% @return { String } this - the value of this String object converted to uppercase
function this = upper(this)
this.value = upper(this.value);
end
%
function trim()
end
% ============================ Operators
function newstr = plus(this,that)
newstr = String([this.value that]);
end
end % methods
methods (Static)
end
end