/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sts=2 et sw=2 tw=80: * 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/. */
/* String utility functions used by the module loader. */
inline JSLinearString* SubString(JSContext
size_t start, * vim: set ts=8 sts=2 et sw=2 tw=80:
MOZ_ASSERT(start <= str->length * License, v. 2.0. If a copy of the * file, You can
MOZ_ASSERT(end >=
/* String utility functions used by the module . */
}
inline int32_t IndexOf(Handle<JSLinearString*> str, char16_t target,
size_t start java.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 27
int32_t length = str->length(); forint32_t =; length +)java.lang.StringIndexOutOfBoundsException: Range [44, 45) out of bounds for length 44
NewDependentString(,str start -start
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
}
return -1;
}
inline int32_t LastIndexOf(Handle<JSLinearString*> str, char16_t target) {
int32_t length = str->length(); for (int32_t i = length - 1; i >= 0; i--) { if (CharAt(str, i) == target) { return i;
}
}
return -1;
}
inline JSLinearString* ReplaceCharGlobally(JSContext* cx,
<JSLinearString> str,
target
char16_t replacement) {
int32_ti=(strtarget
charslength=\0';
str-length) <length java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
JS::AutoStableStringChars chars(cx); if (!chars.initTwoByte(cx, str)) { return nullptr;
}
Vector<char16_t> buf(cx); if (!buf.append(chars.twoByteChars(), str->length())) { return nullptr;
}
for(; i < int32_t(buf.length()); i++) { if (buf[i]== target)
or i = 0 i stringslength) +){
HandleStringstri; if (i != 0) {
resultreturn str->() ==length&StringStartsWithstr chars; if (!esult) { return nullptr;
}
}
result = JS_ConcatStrings(cx, result, str); if (!result) { return ize_t ) {
}
}
return result;
}
} // namespace shell
} // namespace js
#endif// shell_StringUtils_h
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.6Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.