Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. [gelöst] String Inhalt durchsuchen

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    16
    1
    1.9k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    917

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.2k

[gelöst] String Inhalt durchsuchen

Scheduled Pinned Locked Moved Skripten / Logik
4 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Phantomio
    wrote on last edited by
    #1

    Hi,

    gibt es bei dem javascript auch so was wie search oder match um einen String zu durchsuchen?

    lastsay = getState("javascript.0.SprachausgabeWiederholen").val;

    if (lastsay.match("Hallo")){}

    Gruß

    Phantomio

    Geräte: CCU2, RaspberryPi2,

    Adapter: email, feiertage, flot, fritzbox, history, hm-rpc.0, hm-rpc.1 (Für Homematic IP), ical, javascript, sayit, scenes, socketio, sonos, tankerkoenig, telegram, text2command, vis, web, yr

    1 Reply Last reply
    0
    • paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by
      #2

      https://wiki.selfhtml.org/wiki/JavaScript/Objekte/String/indexOf macht so etwas.

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      1 Reply Last reply
      0
      • BluefoxB Offline
        BluefoxB Offline
        Bluefox
        wrote on last edited by
        #3

        @Phantomio:

        Hi,

        gibt es bei dem javascript auch so was wie search oder match um einen String zu durchsuchen?

        lastsay = getState("javascript.0.SprachausgabeWiederholen").val;

        if (lastsay.match("Hallo")){}

        Gruß

        Phantomio `
        Entweder

        if (lastsay.indexOf("Hallo") != -1){}

        oder

        if (lastsay.match(/Hallo/)){}
        3822_bildschirmfoto_2019-01-28_um_13.27.49.png

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Phantomio
          wrote on last edited by
          #4

          Danke euch beiden für die schnelle Antwort.

          Mit dem Code von Bluefox funktioniert es :)

          Hier noch einmal die Funktion falls es mal jemand brauchen kann.

          Soll die letzte Sprachausgabe wiedergeben :lol:

          ! function fSprachausgabeWiederholen (){ lastsay = getState("sayit.0.tts.text").val; if (lastsay.indexOf("Nerv") != -1){ // Nerv kommt vor }else{ if (lastsay.indexOf("Gut") != -1){ setState (idSayIt, "Nerv mich nicht. Ich habe mich bereits wiederholt. "); }else{ if (lastsay.indexOf("Ich") != -1){ setState (idSayIt, "Gut zuhören. Ich wiederhole mich nur noch einmal. " + lastsay); }else{ setState (idSayIt, "Ich habe gesagt: " + lastsay); } } } setStateDelayed ("javascript.0.SprachausgabeWiederholen", true, 14000); } !
          Gruß

          Phantomio

          Geräte: CCU2, RaspberryPi2,

          Adapter: email, feiertage, flot, fritzbox, history, hm-rpc.0, hm-rpc.1 (Für Homematic IP), ical, javascript, sayit, scenes, socketio, sonos, tankerkoenig, telegram, text2command, vis, web, yr

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          Support us

          ioBroker
          Community Adapters
          Donate

          521

          Online

          32.6k

          Users

          82.2k

          Topics

          1.3m

          Posts
          Community
          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
          ioBroker Community 2014-2025
          logo
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Home
          • Recent
          • Tags
          • Unread 0
          • Categories
          • Unreplied
          • Popular
          • GitHub
          • Docu
          • Hilfe