def set_to_str(s: set) ->str:
    """
    Convert a set to a string.

    :param s: a set.
    :return: a string. The result is similar to str(s), but if the elements of the set are comparable, they appear in
        ascending order.

    >>> set_to_str({2, 42, 12})
    '{2, 12, 42}'
    """
    try:
        return '{' + str(sorted(s))[1:-1] + '}'
    except TypeError:
        return str(s)
