Keyword Index

Object: SPStringMap

An SPStringMap is a table that allows you to store and look up values based on a string index. It can be used, for example, to keep values associated with names or keep lists of strings to determine when an item already exists in the list.

  • get - Get the value associated with a key.
  • getKeyAtIndex - Get the string key at the Nth position from the start of the map. This can be used to enumerate all items in the map.
  • getSortedKeys - Get a sorted array of the keys for all items in the map.
  • getValueAtIndex - Get the value at the Nth position from the start of the map. This can be used to enumerate all items in the map.
  • length - Returns the number of items in the map
  • remove - Removes a key and associated value from the map.
  • set - Sets a value in the map.
  • Method: get

    Get the value associated with a key.

    var get(keyStr);

    Parameters
    Name Expected Type Description
    keyStr String The key to look up.

    Returns:

    Returns the value associated with the given key

    Method: getKeyAtIndex

    Get the string key at the Nth position from the start of the map. This can be used to enumerate all items in the map.

    var getKeyAtIndex(index);

    Parameters
    Name Expected Type Description
    index int The index of the desired element, must be in the range 0..length-1

    Returns:

    Returns the key at the given index

    Remarks:

    An equivalent way of accessing the keys by index is to use array index notation, e.g. map[index]. This is exactly equivalent to map.getKeyAtIndex(index)

    Method: getSortedKeys

    Get a sorted array of the keys for all items in the map.

    var getSortedKeys();

    Returns:

    Returns an SPArray of strings representing all the keys in this string map in sorted order

    Method: getValueAtIndex

    Get the value at the Nth position from the start of the map. This can be used to enumerate all items in the map.

    var getValueAtIndex(index);

    Parameters
    Name Expected Type Description
    index int The index of the desired element, must be in the range 0..length-1

    Returns:

    Returns the value at the given index

    Method: length

    Returns the number of items in the map

    Method: remove

    Removes a key and associated value from the map.

    void remove(keyStr);

    Parameters
    Name Expected Type Description
    keyStr String The key to remove.

    Method: set

    Sets a value in the map.

    void set(keyStr);

    void set(keyStr, value);

    Parameters
    Name Expected Type Description
    value any The data to be associated with this key. If this is not specified, the boolean value "true" is stored.
    keyStr String The key that will be used to store the value