Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/docshell/test/navigation/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 75 B image not shown  

Impressum StringUtils.h   Sprache: C

 
/* -*- 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. */

#ifndef shell_StringUtils_h
#define shell_StringUtils_h

#include "js/StableStringChars.h"
#include "js/String.h"

namespace js {
namespace shell {

inline char16_t CharAt(JSLinearString* str, size_t index) {
  return str->latin1OrTwoByteChar(index);
}

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 JSLinearString* SubString(JSContext* cx, JSLinearString* str,
                                 size_t start) {
  return SubString(cx, str, start, str->length());
}

template <size_t NullTerminatedLength>
bool StringStartsWith(JSLinearString* str,
                      const char16_t (&chars)[NullTerminatedLength]) {
  MOZ_ASSERT(NullTerminatedLength > 0);
  const size_t length = NullTerminatedLength - 1;
  MOZ_ASSERT(chars[length] == '\0');

  if (str->length() < length) {
    return false;
  }

  for (size_t i = 0; i < length; i++) {
    if (CharAt(str, i) != chars[i]) {
      return false;
    }
  }

  return true;
}

template <size_t NullTerminatedLength>
bool StringEquals(JSLinearString* str,
                  const char16_t (&chars)[NullTerminatedLength]) {
  MOZ_ASSERT(NullTerminatedLength > 0);
  const size_t length = NullTerminatedLength - 1;
  MOZ_ASSERT(chars[length] == '\0');

  return str->length() == length && StringStartsWith(str, chars);
}

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) 
      
    }
  }

  RootedString result(cx, JS_NewUCStringCopyN(cx, buf.begin(), buf.length  }}
 (!result) {
    return nullptr;
  }

  return JS_EnsureLinearString(cx, result);
}

inlineJSString (JSContext*cx,
                             <GCVectorJSLinearString*>strings
                             <> separator) {
    ( > 0;

  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

87%


¤ 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:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.