How to do text replacement?

First of all I’m very new to the Home Assistant,
I found here and there few things that I’d like to replace the shown text (or string?) in the home…
those things didn’t allow a “friendly_name” or couldn’t find other way…
For example I found how to show the next alarm that is set on my phone, but when it’s not set, the default value is set and it shows that my next alarm is at 1970-01-01 00:00 and I’d like in that case to replace the text (not the default value since the phone sends it anyways) as “Alarm not set”
Or, the integration of 17Track for tracking packages, I can show a list of current packages but it shows for example as: Seventeentrack Package: blahbla and I’d like at least to replace "Seventeentrack " to show as “17Track” (again, friendly_name didn’t work)

Both of your examples refer to overriding the text of a particular state of a sensor - not overriding the name of the sensor which is what friendly name does. As far as I know, the only possible way to do this would be to create a template sensor attached to the original sensor with template logic that performs the text swap. As you mention you are new to HA, just a caution that this is not very easy.

So, I tried it…
But not sure where I’m making a mistake…

that’s the code of what I’m trying to replace the text of it’s default value

input_datetime:
  next_alarm:
    name: Next Alarm
    has_date: true
    has_time: true

and that’s the template I tried to write:

- platform: template
  sensors:
    next_alarm:
      friendly_name: "Sun State"
      value_template: >-
        {% if is_state('input_datetime.next_alarm', '1970-01-01 00:00:00') %}
          No alarm set
        {% endif %}

Put in an else that will make the template sensor’s state the same as the input date time when that condition was any true.