Code Duplication    Length = 44-44 lines in 2 locations

src/ub.strings.find.index.js 2 locations

@@ 142-185 (lines=44) @@
139
		return -1;
140
	},
141
142
	_lastIndexOfCI: function(search, startAt, substringIsLower, sl){
143
		var text = this;
144
		
145
		// init casing tables
146
		if (UB.UTF_lowerToUpper == null){
147
			UB.initCasing();
148
		}
149
		
150
		// per main char
151
		for (var m = startAt;m >= 0;m--){
152
			
153
			
154
			// per substring char
155
			match = true;
156
			for (var s = 0;s<sl;s++){
157
				
158
				c1 = text.charCodeAt(m + s);
159
				c2 = search.charCodeAt(s);
160
				
161
				// CI
162
				if (c1 <= UB.UTF_casingTablesMax){ /// CI
163
					c1 = UB.UTF_upperToLower[c1];
164
				}
165
				if (!substringIsLower){
166
					if (c2 <= UB.UTF_casingTablesMax){ /// CI
167
						c2 = UB.UTF_upperToLower[c2];
168
					}
169
				}
170
				
171
				if (c1 != c2) {
172
					match = false;
173
					break;
174
				}
175
				
176
			}
177
			
178
			if (match){
179
				return m;
180
			}
181
			
182
		}
183
		
184
		return -1;
185
	},
186
187
	countOf: function(find, caseSensitive = true){
188
		var text = this;
@@ 97-140 (lines=44) @@
94
		return text.lastIndexOf(search, startAt);
95
	},
96
97
	_indexOfCI: function(search, startAt, substringIsLower, sl, ml){
98
		var text = this;
99
100
		// init casing tables
101
		if (UB.UTF_lowerToUpper == null){
102
			UB.initCasing();
103
		}
104
		
105
		// per main char
106
		for (var m = startAt;m <= ml;m++){
107
							
108
							
109
			// per substring char
110
			var match = true;
111
			for (var s = 0;s<sl;s++){
112
				
113
				var c1 = text.charCodeAt(m + s);
114
				var c2 = search.charCodeAt(s);
115
				
116
				// CI
117
				if (c1 <= UB.UTF_casingTablesMax){ /// CI
118
					c1 = UB.UTF_upperToLower[c1];
119
				}
120
				if (!substringIsLower){
121
					if (c2 <= UB.UTF_casingTablesMax){ /// CI
122
						c2 = UB.UTF_upperToLower[c2];
123
					}
124
				}
125
				
126
				if (c1 != c2) {
127
					match = false;
128
					break;
129
				}
130
				
131
			}
132
			
133
			if (match){
134
				return m;
135
			}
136
			
137
		}
138
139
		return -1;
140
	},
141
142
	_lastIndexOfCI: function(search, startAt, substringIsLower, sl){
143
		var text = this;