def _str_to_ord(content, weights, alphabet):
    """Converts a string to its lexicographical order.
    
    Args:
      content: the string to convert. Of type str.
      weights: weights from _get_weights.
    
    Returns:
      an int or long that represents the order of this string. "" has order 0.
    """
    ordinal = 0
    for i, c in enumerate(content):
        ordinal += weights[i] * alphabet.index(c) + 1
    return ordinal