SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface IStringCollection

    Contains a collection of interned strings.

    Keyed by the string's id, not ordered: iteration order is unspecified.

    interface IStringCollection {
        isICollection: true;
        isIStringCollection: true;
        "[iterator]"(): IterableIterator<string>;
        add(shared: string): number;
        addListeners(
            listeners: ICollection.IListeners,
            options?: IListener.Options,
        ): Remove;
        addMultiple(shared: string[], conflateDuplicates?: boolean): void;
        at(index: number): string | undefined;
        beginPersist(): ICollection.IPersistScope<string>;
        every(
            predicate: (
                value: string,
                index: number,
                items: readonly string[],
            ) => boolean,
        ): boolean;
        filter<S extends string>(
            predicate: (
                value: string,
                index: number,
                items: readonly string[],
            ) => value is S,
        ): S[];
        filter(
            predicate: (
                value: string,
                index: number,
                items: readonly string[],
            ) => boolean,
        ): string[];
        find<S extends string>(
            predicate: (
                value: string,
                index: number,
                items: readonly string[],
            ) => value is S,
        ): S | undefined;
        find(
            predicate: (
                value: string,
                index: number,
                items: readonly string[],
            ) => boolean,
        ): string | undefined;
        findIndex(
            predicate: (
                value: string,
                index: number,
                items: readonly string[],
            ) => boolean,
        ): number;
        forEach(
            fn: (value: string, index: number, items: readonly string[]) => void,
        ): void;
        getById(id: number): string | null;
        getCount(): number;
        getItems(options?: ICollection.GetItemsOptions): string[];
        indexOf(item: string): number;
        isClosed(): boolean;
        map<U>(
            fn: (value: string, index: number, items: readonly string[]) => U,
        ): U[];
        some(
            predicate: (
                value: string,
                index: number,
                items: readonly string[],
            ) => boolean,
        ): boolean;
        toArray(): string[];
    }

    Hierarchy (View Summary)

    Implemented by

    Index
    isICollection: true

    For runtime type checking.

    isIStringCollection: true

    For runtime type checking.

    • Iterates the collection's items.

      Returns IterableIterator<string>

      The unfiltered walk — for (const sheet of wb.getSheets()). Every other iterable surface in the SDK (ICellRange, ICellRegions, ICellRanges) reads this way, so a collection that did not was a trap: for…of over one is the obvious line to write and it threw at runtime with nothing in the types to warn first.

      getItems remains the call that takes options — filtering, ordering, anything parameterized. This is sugar over the unfiltered case, not a replacement for it.

    • Add a string to the collection.

      Parameters

      • shared: string

        A string

      Returns number

      Resources are not removed from the the collection. They are autoGCed when there are no references.

    • Add multiple string to the collection.

      Parameters

      • shared: string[]

        An array of strings

      • OptionalconflateDuplicates: boolean

        If the same string is in the list it will be conflated. Default value false.

      Returns void

      There are instances where Excel may have duplicate strings so by default this is false.

    • Returns the item at the given index, or undefined if there is none.

      Parameters

      • index: number

        The position in iteration order. A negative index counts back from the end, as Array.prototype.at does.

      Returns string | undefined

    • Returns true if the predicate accepts every item, including when there are none.

      Parameters

      • predicate: (value: string, index: number, items: readonly string[]) => boolean

        Called once per item in iteration order until it returns false.

      Returns boolean

    • Returns the items the predicate accepts, in iteration order.

      Type Parameters

      • S extends string

      Parameters

      • predicate: (value: string, index: number, items: readonly string[]) => value is S

        Called once per item.

      Returns S[]

    • Returns the items the predicate accepts, in iteration order.

      Parameters

      • predicate: (value: string, index: number, items: readonly string[]) => boolean

        Called once per item.

      Returns string[]

    • Returns the first item the predicate accepts, or undefined if it accepts none.

      Type Parameters

      • S extends string

      Parameters

      • predicate: (value: string, index: number, items: readonly string[]) => value is S

        Called once per item in iteration order until it returns true.

      Returns S | undefined

    • Returns the first item the predicate accepts, or undefined if it accepts none.

      Parameters

      • predicate: (value: string, index: number, items: readonly string[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns string | undefined

    • Returns the index of the first item the predicate accepts, or -1 if it accepts none.

      Parameters

      • predicate: (value: string, index: number, items: readonly string[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns number

    • Calls the function once per item, in iteration order.

      Parameters

      • fn: (value: string, index: number, items: readonly string[]) => void

        Called once per item.

      Returns void

    • Returns the string for the given id, or null if not found.

      Parameters

      • id: number

        The id

      Returns string | null

    • Returns the total items available.

      Returns number

      returns the total number of items available.

    • Returns the items in the collection.

      Parameters

      Returns string[]

      The optioned call — filtering, ordering, anything parameterized — and a snapshot: the array returned does not follow later changes to the collection. For the unfiltered items as a plain array prefer toArray.

    • Returns the index of the item in iteration order, or -1 if it is not in the collection.

      Parameters

      • item: string

        The item to find.

      Returns number

    • Returns true once the collection has been closed.

      Returns boolean

      A closed collection is empty and announces nothing further. Collections that are closed by their owner (the workbook's names, functions and modules, when the workbook closes) announce it once with ICollection.Events.onClose; the others are never closed and always return false.

    • Returns the result of calling the function on every item, in iteration order.

      Type Parameters

      • U

      Parameters

      • fn: (value: string, index: number, items: readonly string[]) => U

        Called once per item.

      Returns U[]

    • Returns true if the predicate accepts at least one item.

      Parameters

      • predicate: (value: string, index: number, items: readonly string[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns boolean

    • Returns the items as a fresh array, in iteration order.

      Returns string[]

      The call to make when an array is really wanted. The array is the caller's: changing it does not change the collection, and it does not follow later changes to the collection.