/# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #/ ;enum TEXT_ENCODING [uint] { UTF_8, UN7_1, ASCII } ;struct String extends Vector(uint8) { uint encoding } /; method String # Returns index of first difference, or -1 if there is no difference /; diff_index (String str) [int] ;uint l = math.mint(uint, str.length, self.length) /; loop (uint i = 0; i < l) [i++] /; if (self{i} != str{i}) ;return i [int] ;/ ;/ /; if () ;/ ;return -1 ;/ /; override operator == (String str) [bool] /; if (self.encoding != str.encoding || self.length != str.length) ;return false ;/ ;return diff_index(str) == -1 ;/ ;/