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. Blockly
  5. [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.8k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.2k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    16
    1
    3.2k

[Vorlage] Blockly - Beliebiges Zeichen im Text tauschen

Scheduled Pinned Locked Moved Blockly
blocklytemplate
70 Posts 13 Posters 14.5k Views 22 Watching
  • 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.
  • rantanplanR rantanplan

    Hallo

    Manchmal ist es notwendig unliebsame Zeichen aus einem Text zu entfernen um diese z.B. in VIS vernünftig darstellen zu können.
    Mit dem folgenden Blockly kann man jedes Zeichen, ganze Wörter oder eine Folge von Steuerzeichen gegen etwas anderes tauschen.

    Der von @robson gefundene Bug wurde behoben.

    Zeichentausch.png

    Hier der geänderte Export:

    <xml xmlns="https://developers.google.com/blockly/xml">
      <variables>
        <variable id="xSVSX?qYBxERx4)1(5:3">originalText</variable>
        <variable id=";bO,k;{f-t4YW^V4Yaby">suchText</variable>
        <variable id="=KxFmb,!C-6!HK%6iSz4">tauschText</variable>
        <variable id="pF_ac~cY~|C(S.I!U%Uu">MeinText</variable>
        <variable id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</variable>
        <variable id="P8$b81v9fsrHHrb+z]g1">Text</variable>
        <variable id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</variable>
        <variable id="I;i^c)UORMgY^LOatF[8">neuerText</variable>
        <variable id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</variable>
        <variable id="(NMF97xgk;{xp~AH$Ln*">Stelle</variable>
      </variables>
      <block type="comment" id="?t^|J^}%io+OnqAwVT4A" x="-237" y="-87">
        <field name="COMMENT">Beliebige Zeichen tauschen</field>
        <next>
          <block type="variables_set" id="-P{_[1=caHEAoB9cP4Qx">
            <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
            <value name="VALUE">
              <block type="text" id="]-v|)OoSpw-K*Z-|~Z|L">
                <field name="TEXT">Dieser Text müßte geändert werden.</field>
              </block>
            </value>
            <next>
              <block type="controls_if" id="eO-Yu;zv=:r~yJNHR:iS">
                <value name="IF0">
                  <block type="logic_negate" id="u@28{:]xG=4a9HU}|/v)">
                    <value name="BOOL">
                      <block type="text_isEmpty" id="W-_T.2)lUsLG/Z(5zIQN">
                        <value name="VALUE">
                          <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="9LrDM?0xYv?MX-(}2OrI">
                            <field name="TEXT"></field>
                          </shadow>
                          <block type="variables_get" id="B?L(8|(8?-Z7Ao*[F/VM">
                            <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                          </block>
                        </value>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO0">
                  <block type="variables_set" id="ziw)~y|7*7le5/J*8HC#">
                    <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                    <value name="VALUE">
                      <block type="procedures_callreturn" id="ECH/%?YEFylSUOK._8/K">
                        <mutation name="changeText">
                          <arg name="originalText"></arg>
                          <arg name="suchText"></arg>
                          <arg name="tauschText"></arg>
                        </mutation>
                        <value name="ARG0">
                          <block type="variables_get" id="Y(bM=~D[D5v)7a#1{`}`">
                            <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                          </block>
                        </value>
                        <value name="ARG1">
                          <block type="text" id="(iqf|@QE;6:tP0}rbaEj">
                            <field name="TEXT">ü</field>
                          </block>
                        </value>
                        <value name="ARG2">
                          <block type="text" id="_{HiLh|2|F3|a#[4lCvX">
                            <field name="TEXT">ue</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <next>
                      <block type="variables_set" id="`vGUP!R!*|3sjY~dZXxZ">
                        <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                        <value name="VALUE">
                          <block type="procedures_callreturn" id="rvKR.cz9FhImw~YT8:YY">
                            <mutation name="changeText">
                              <arg name="originalText"></arg>
                              <arg name="suchText"></arg>
                              <arg name="tauschText"></arg>
                            </mutation>
                            <value name="ARG0">
                              <block type="variables_get" id="4r-=T6yu%Y[}Zn!QhpR/">
                                <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                              </block>
                            </value>
                            <value name="ARG1">
                              <block type="text" id="mbk@+N`6F_eG)N%Jw|2J">
                                <field name="TEXT">ä</field>
                              </block>
                            </value>
                            <value name="ARG2">
                              <block type="text" id="OtGH;LSHf;*t,59fJ)5i">
                                <field name="TEXT">ae</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <next>
                          <block type="variables_set" id="3+|QU5[xS;U@Qijfuu@7">
                            <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                            <value name="VALUE">
                              <block type="procedures_callreturn" id="~C~TrH*=xX3Xl-l@tg#V">
                                <mutation name="changeText">
                                  <arg name="originalText"></arg>
                                  <arg name="suchText"></arg>
                                  <arg name="tauschText"></arg>
                                </mutation>
                                <value name="ARG0">
                                  <block type="variables_get" id=",eH?bND1?H}TimRX_wnz">
                                    <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                  </block>
                                </value>
                                <value name="ARG1">
                                  <block type="text" id="6AWuk;A#5~8;jXas31)I">
                                    <field name="TEXT">ß</field>
                                  </block>
                                </value>
                                <value name="ARG2">
                                  <block type="text" id="[M[ZL8Y,u8fNWw|eR|g)">
                                    <field name="TEXT">ss</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <next>
                              <block type="debug" id="g8IUrYe_.rei!S6]Mc?a">
                                <field name="Severity">log</field>
                                <value name="TEXT">
                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                    <field name="TEXT"></field>
                                  </shadow>
                                  <block type="variables_get" id="^/WzSct]9kWQNOvtqOg/">
                                    <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                                  </block>
                                </value>
                                <next>
                                  <block type="debug" id="Hme!w3Ag?_DUH%uRzR)U">
                                    <field name="Severity">log</field>
                                    <value name="TEXT">
                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                        <field name="TEXT"></field>
                                      </shadow>
                                      <block type="variables_get" id="`v3q2Xw=qC`r6)o/kUEY">
                                        <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                      </block>
                                    </value>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </statement>
              </block>
            </next>
          </block>
        </next>
      </block>
      <block type="procedures_defreturn" id="*?%n[KG5e1!^tNun#Hj5" x="288" y="-87">
        <mutation>
          <arg name="originalText" varid="xSVSX?qYBxERx4)1(5:3"></arg>
          <arg name="suchText" varid=";bO,k;{f-t4YW^V4Yaby"></arg>
          <arg name="tauschText" varid="=KxFmb,!C-6!HK%6iSz4"></arg>
        </mutation>
        <field name="NAME">changeText</field>
        <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
        <statement name="STACK">
          <block type="variables_set" id=",*Bi*dYY8!8mI7(mg9V.">
            <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
            <value name="VALUE">
              <block type="text" id="|BZm+^ZNZWW}2Oo#`j;?">
                <field name="TEXT"></field>
              </block>
            </value>
            <next>
              <block type="variables_set" id="w]M[kO6!;:DS!~0O}SHV">
                <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                <value name="VALUE">
                  <block type="text" id="LK!;|?K5!yeQYlUax(!P">
                    <field name="TEXT"></field>
                  </block>
                </value>
                <next>
                  <block type="variables_set" id="LyZ2%lYW+kfm,4)yV8UN">
                    <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                    <value name="VALUE">
                      <block type="variables_get" id="da5*p]}sO:{{|ZE!nhDe">
                        <field name="VAR" id="xSVSX?qYBxERx4)1(5:3">originalText</field>
                      </block>
                    </value>
                    <next>
                      <block type="variables_set" id="yx;qp1@1fC(oiG4c5gZt">
                        <field name="VAR" id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</field>
                        <value name="VALUE">
                          <block type="text_length" id="Jwz33ARDLc!=8:eDagDD">
                            <value name="VALUE">
                              <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="RZWm!~Yo4w5)66Gu|Gs_">
                                <field name="TEXT">abc</field>
                              </shadow>
                              <block type="variables_get" id="G2I+np)5qee]q{4)BlN2">
                                <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <next>
                          <block type="variables_set" id="eAGK[85W)DRaIaN!oMiH">
                            <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                            <value name="VALUE">
                              <block type="text_indexOf" id="/@rj}{;VUCJ8O|28^(Hf">
                                <field name="END">FIRST</field>
                                <value name="VALUE">
                                  <block type="variables_get" id="}de%ffO*rIt%j6)99pf3">
                                    <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                  </block>
                                </value>
                                <value name="FIND">
                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="7MprEQxoWq}#3~Xz:32k">
                                    <field name="TEXT">%0D%0A</field>
                                  </shadow>
                                  <block type="variables_get" id="7)r.X1a~Tee1!dAwZy`!">
                                    <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <next>
                              <block type="controls_whileUntil" id="4lR}{f])DWKyjt}.(6cc">
                                <field name="MODE">WHILE</field>
                                <value name="BOOL">
                                  <block type="logic_compare" id="e`eUWK6kyOU=[/x]M({`">
                                    <field name="OP">GT</field>
                                    <value name="A">
                                      <block type="variables_get" id="}7HLWRwI(SDg1^@=czoV">
                                        <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                      </block>
                                    </value>
                                    <value name="B">
                                      <block type="math_number" id="#y,za{r#@s7Ri.U!9v)A">
                                        <field name="NUM">0</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <statement name="DO">
                                  <block type="comment" id="38%#2?@btrH6%hebNg3_">
                                    <field name="COMMENT">Wenn nicht erste Zeichen im Text!</field>
                                    <next>
                                      <block type="controls_if" id="R]}Pl(*eeA:Dh@;{q_CH">
                                        <value name="IF0">
                                          <block type="logic_compare" id="l,u?h{)Z-u/OozI,.79G">
                                            <field name="OP">GT</field>
                                            <value name="A">
                                              <block type="variables_get" id="B/K~z.ANK2);I3(uk4Bh">
                                                <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id="|3~K:6jrHq7oxz=fL:Yz">
                                                <field name="NUM">1</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="variables_set" id="{R*X,7K)DA^dq/.~KK7{">
                                            <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
                                            <value name="VALUE">
                                              <block type="text_getSubstring" id="Img0opt.EB#)RM-bp~hw">
                                                <mutation at1="false" at2="true"></mutation>
                                                <field name="WHERE1">FIRST</field>
                                                <field name="WHERE2">FROM_START</field>
                                                <value name="STRING">
                                                  <block type="variables_get" id="A9h*F{tgJR0y[Q0uv7,=">
                                                    <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                  </block>
                                                </value>
                                                <value name="AT2">
                                                  <block type="math_arithmetic" id="([5R[:8Ywn-thKN@r:~}">
                                                    <field name="OP">MINUS</field>
                                                    <value name="A">
                                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="u@:!j5WimCjV%fG9hPGs">
                                                        <field name="NUM">1</field>
                                                      </shadow>
                                                      <block type="variables_get" id="U0qw,~,2KoaAc37UO{l#">
                                                        <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <shadow type="math_number" id="DT#zRSRu1.y^|5Z#G37W">
                                                        <field name="NUM">1</field>
                                                      </shadow>
                                                    </value>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                          </block>
                                        </statement>
                                        <next>
                                          <block type="variables_set" id="Else^,?QE9TTS.Y%K]W=">
                                            <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                                            <value name="VALUE">
                                              <block type="text_getSubstring" id="e8A7NqY7O!@K(aFlMpV#" inline="false">
                                                <mutation at1="true" at2="false"></mutation>
                                                <field name="WHERE1">FROM_START</field>
                                                <field name="WHERE2">LAST</field>
                                                <value name="STRING">
                                                  <block type="variables_get" id="|jU0g8+eIgwn_|IB56)@">
                                                    <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                  </block>
                                                </value>
                                                <value name="AT1">
                                                  <block type="math_arithmetic" id="F#*%;R9ugmwaaas?WBwG">
                                                    <field name="OP">ADD</field>
                                                    <value name="A">
                                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="8/I%=/~YReHV]Iwo{}(J">
                                                        <field name="NUM">1</field>
                                                      </shadow>
                                                      <block type="variables_get" id="R0|a}kx2M~SYjPKS5Cc{">
                                                        <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id=";Q(aJ::90?0?H;-45cgS">
                                                        <field name="NUM">0</field>
                                                      </shadow>
                                                      <block type="variables_get" id="dY33=1IVxkrSH1k1#X6A">
                                                        <field name="VAR" id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="variables_set" id="OcJS!-Ku1vQY4)I+r,gc">
                                                <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                <value name="VALUE">
                                                  <block type="text_join" id="%%D@nUqB1tt^`?qrUahx">
                                                    <mutation items="3"></mutation>
                                                    <value name="ADD0">
                                                      <block type="variables_get" id="q]l%0Dpb89BZy1-m[TjM">
                                                        <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
                                                      </block>
                                                    </value>
                                                    <value name="ADD1">
                                                      <block type="variables_get" id="f~POFU0}K4-w]xVc1?,`">
                                                        <field name="VAR" id="=KxFmb,!C-6!HK%6iSz4">tauschText</field>
                                                      </block>
                                                    </value>
                                                    <value name="ADD2">
                                                      <block type="variables_get" id="U77~u,Qfmb2g[O19eHoh">
                                                        <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="variables_set" id="lao?KUxF77Si~Xc2j%^{">
                                                    <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                    <value name="VALUE">
                                                      <block type="text_indexOf" id="[),PN,ZrAW,C/~:K[x[:">
                                                        <field name="END">FIRST</field>
                                                        <value name="VALUE">
                                                          <block type="variables_get" id="6{t:BeVh6=bsQF(zUhYG">
                                                            <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                          </block>
                                                        </value>
                                                        <value name="FIND">
                                                          <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="{Vd/Su8uk@lo|:3KMi1L">
                                                            <field name="TEXT">%0D%0A</field>
                                                          </shadow>
                                                          <block type="variables_get" id="r|~fKkGR#@1@G6_GX`-g">
                                                            <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </statement>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </statement>
        <value name="RETURN">
          <block type="variables_get" id=".*DA-:q/GzURSEPH2ZiQ">
            <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
          </block>
        </value>
      </block>
    </xml>
    

    Bei Fragen, fragen.

    Grüße

    David G.D Online
    David G.D Online
    David G.
    wrote on last edited by
    #50

    @rantanplan

    Hallo,

    danke für deine Vorlage.
    Baue Sie grad nach.

    Aber irgendwie bin ich zu doof, den "change Text" Baustein zu finden.

    Kann mir jemand sagen, wie ich den erreiche?

    Zeigt eure Lovelace-Visualisierung klick
    (Auch ideal um sich Anregungen zu holen)

    Meine Tabellen für eure Visualisierung klick

    dslraserD 1 Reply Last reply
    0
    • David G.D David G.

      @rantanplan

      Hallo,

      danke für deine Vorlage.
      Baue Sie grad nach.

      Aber irgendwie bin ich zu doof, den "change Text" Baustein zu finden.

      Kann mir jemand sagen, wie ich den erreiche?

      dslraserD Offline
      dslraserD Offline
      dslraser
      Forum Testing Most Active
      wrote on last edited by dslraser
      #51

      @David-G
      wenn Du es nachbaust mußt Du den selbst erstellen, das ist eine Funktion.
      (oder Du importierst den Export aus dem ersten Beitrag)

      David G.D 1 Reply Last reply
      0
      • dslraserD dslraser

        @David-G
        wenn Du es nachbaust mußt Du den selbst erstellen, das ist eine Funktion.
        (oder Du importierst den Export aus dem ersten Beitrag)

        David G.D Online
        David G.D Online
        David G.
        wrote on last edited by
        #52

        @dslraser

        Importieren ist was doof, möchte es in ein größeres Script was ich schon habe integrieren.
        Kann man die Funktion aus dem Export extrahieren?

        Zeigt eure Lovelace-Visualisierung klick
        (Auch ideal um sich Anregungen zu holen)

        Meine Tabellen für eure Visualisierung klick

        dslraserD 1 Reply Last reply
        0
        • David G.D David G.

          @dslraser

          Importieren ist was doof, möchte es in ein größeres Script was ich schon habe integrieren.
          Kann man die Funktion aus dem Export extrahieren?

          dslraserD Offline
          dslraserD Offline
          dslraser
          Forum Testing Most Active
          wrote on last edited by
          #53

          @David-G
          Man kann jeden einzelnen Baustein oder sogar ganze Bereiche extrahieren. Einfach den Baustein, also die gesamte Funktion anklicken und dann exportieren in die Zwischenablage und wieder in Dein anderes Blockly importieren.

          David G.D 2 Replies Last reply
          0
          • dslraserD dslraser

            @David-G
            Man kann jeden einzelnen Baustein oder sogar ganze Bereiche extrahieren. Einfach den Baustein, also die gesamte Funktion anklicken und dann exportieren in die Zwischenablage und wieder in Dein anderes Blockly importieren.

            David G.D Online
            David G.D Online
            David G.
            wrote on last edited by
            #54

            @dslraser

            Dann schaue ich nachher mal, ob ich die Funktion finde, wenn man auch in ein bestehendes Script einzelne Teile importieren kann.

            Zeigt eure Lovelace-Visualisierung klick
            (Auch ideal um sich Anregungen zu holen)

            Meine Tabellen für eure Visualisierung klick

            1 Reply Last reply
            0
            • dslraserD dslraser

              @David-G
              Man kann jeden einzelnen Baustein oder sogar ganze Bereiche extrahieren. Einfach den Baustein, also die gesamte Funktion anklicken und dann exportieren in die Zwischenablage und wieder in Dein anderes Blockly importieren.

              David G.D Online
              David G.D Online
              David G.
              wrote on last edited by
              #55

              @dslraser

              Habs hinbekommen.
              Die Tabelle von der wir gestern gesprochen habe, habe ich jetzt auch mit dem Pingadapter umgesetzt.
              Der haut immer ein doofes "Alive" vor den Namen.

              Jetzt ist es weg (und kann noch ein wenig Einfluss nehmen).

              Zeigt eure Lovelace-Visualisierung klick
              (Auch ideal um sich Anregungen zu holen)

              Meine Tabellen für eure Visualisierung klick

              1 Reply Last reply
              1
              • rantanplanR rantanplan

                Hallo

                Manchmal ist es notwendig unliebsame Zeichen aus einem Text zu entfernen um diese z.B. in VIS vernünftig darstellen zu können.
                Mit dem folgenden Blockly kann man jedes Zeichen, ganze Wörter oder eine Folge von Steuerzeichen gegen etwas anderes tauschen.

                Der von @robson gefundene Bug wurde behoben.

                Zeichentausch.png

                Hier der geänderte Export:

                <xml xmlns="https://developers.google.com/blockly/xml">
                  <variables>
                    <variable id="xSVSX?qYBxERx4)1(5:3">originalText</variable>
                    <variable id=";bO,k;{f-t4YW^V4Yaby">suchText</variable>
                    <variable id="=KxFmb,!C-6!HK%6iSz4">tauschText</variable>
                    <variable id="pF_ac~cY~|C(S.I!U%Uu">MeinText</variable>
                    <variable id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</variable>
                    <variable id="P8$b81v9fsrHHrb+z]g1">Text</variable>
                    <variable id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</variable>
                    <variable id="I;i^c)UORMgY^LOatF[8">neuerText</variable>
                    <variable id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</variable>
                    <variable id="(NMF97xgk;{xp~AH$Ln*">Stelle</variable>
                  </variables>
                  <block type="comment" id="?t^|J^}%io+OnqAwVT4A" x="-237" y="-87">
                    <field name="COMMENT">Beliebige Zeichen tauschen</field>
                    <next>
                      <block type="variables_set" id="-P{_[1=caHEAoB9cP4Qx">
                        <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                        <value name="VALUE">
                          <block type="text" id="]-v|)OoSpw-K*Z-|~Z|L">
                            <field name="TEXT">Dieser Text müßte geändert werden.</field>
                          </block>
                        </value>
                        <next>
                          <block type="controls_if" id="eO-Yu;zv=:r~yJNHR:iS">
                            <value name="IF0">
                              <block type="logic_negate" id="u@28{:]xG=4a9HU}|/v)">
                                <value name="BOOL">
                                  <block type="text_isEmpty" id="W-_T.2)lUsLG/Z(5zIQN">
                                    <value name="VALUE">
                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="9LrDM?0xYv?MX-(}2OrI">
                                        <field name="TEXT"></field>
                                      </shadow>
                                      <block type="variables_get" id="B?L(8|(8?-Z7Ao*[F/VM">
                                        <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <statement name="DO0">
                              <block type="variables_set" id="ziw)~y|7*7le5/J*8HC#">
                                <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                <value name="VALUE">
                                  <block type="procedures_callreturn" id="ECH/%?YEFylSUOK._8/K">
                                    <mutation name="changeText">
                                      <arg name="originalText"></arg>
                                      <arg name="suchText"></arg>
                                      <arg name="tauschText"></arg>
                                    </mutation>
                                    <value name="ARG0">
                                      <block type="variables_get" id="Y(bM=~D[D5v)7a#1{`}`">
                                        <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                                      </block>
                                    </value>
                                    <value name="ARG1">
                                      <block type="text" id="(iqf|@QE;6:tP0}rbaEj">
                                        <field name="TEXT">ü</field>
                                      </block>
                                    </value>
                                    <value name="ARG2">
                                      <block type="text" id="_{HiLh|2|F3|a#[4lCvX">
                                        <field name="TEXT">ue</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <next>
                                  <block type="variables_set" id="`vGUP!R!*|3sjY~dZXxZ">
                                    <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                    <value name="VALUE">
                                      <block type="procedures_callreturn" id="rvKR.cz9FhImw~YT8:YY">
                                        <mutation name="changeText">
                                          <arg name="originalText"></arg>
                                          <arg name="suchText"></arg>
                                          <arg name="tauschText"></arg>
                                        </mutation>
                                        <value name="ARG0">
                                          <block type="variables_get" id="4r-=T6yu%Y[}Zn!QhpR/">
                                            <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                          </block>
                                        </value>
                                        <value name="ARG1">
                                          <block type="text" id="mbk@+N`6F_eG)N%Jw|2J">
                                            <field name="TEXT">ä</field>
                                          </block>
                                        </value>
                                        <value name="ARG2">
                                          <block type="text" id="OtGH;LSHf;*t,59fJ)5i">
                                            <field name="TEXT">ae</field>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                    <next>
                                      <block type="variables_set" id="3+|QU5[xS;U@Qijfuu@7">
                                        <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                        <value name="VALUE">
                                          <block type="procedures_callreturn" id="~C~TrH*=xX3Xl-l@tg#V">
                                            <mutation name="changeText">
                                              <arg name="originalText"></arg>
                                              <arg name="suchText"></arg>
                                              <arg name="tauschText"></arg>
                                            </mutation>
                                            <value name="ARG0">
                                              <block type="variables_get" id=",eH?bND1?H}TimRX_wnz">
                                                <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                              </block>
                                            </value>
                                            <value name="ARG1">
                                              <block type="text" id="6AWuk;A#5~8;jXas31)I">
                                                <field name="TEXT">ß</field>
                                              </block>
                                            </value>
                                            <value name="ARG2">
                                              <block type="text" id="[M[ZL8Y,u8fNWw|eR|g)">
                                                <field name="TEXT">ss</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <next>
                                          <block type="debug" id="g8IUrYe_.rei!S6]Mc?a">
                                            <field name="Severity">log</field>
                                            <value name="TEXT">
                                              <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                                <field name="TEXT"></field>
                                              </shadow>
                                              <block type="variables_get" id="^/WzSct]9kWQNOvtqOg/">
                                                <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="debug" id="Hme!w3Ag?_DUH%uRzR)U">
                                                <field name="Severity">log</field>
                                                <value name="TEXT">
                                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                                    <field name="TEXT"></field>
                                                  </shadow>
                                                  <block type="variables_get" id="`v3q2Xw=qC`r6)o/kUEY">
                                                    <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </statement>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                  <block type="procedures_defreturn" id="*?%n[KG5e1!^tNun#Hj5" x="288" y="-87">
                    <mutation>
                      <arg name="originalText" varid="xSVSX?qYBxERx4)1(5:3"></arg>
                      <arg name="suchText" varid=";bO,k;{f-t4YW^V4Yaby"></arg>
                      <arg name="tauschText" varid="=KxFmb,!C-6!HK%6iSz4"></arg>
                    </mutation>
                    <field name="NAME">changeText</field>
                    <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                    <statement name="STACK">
                      <block type="variables_set" id=",*Bi*dYY8!8mI7(mg9V.">
                        <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
                        <value name="VALUE">
                          <block type="text" id="|BZm+^ZNZWW}2Oo#`j;?">
                            <field name="TEXT"></field>
                          </block>
                        </value>
                        <next>
                          <block type="variables_set" id="w]M[kO6!;:DS!~0O}SHV">
                            <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                            <value name="VALUE">
                              <block type="text" id="LK!;|?K5!yeQYlUax(!P">
                                <field name="TEXT"></field>
                              </block>
                            </value>
                            <next>
                              <block type="variables_set" id="LyZ2%lYW+kfm,4)yV8UN">
                                <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                <value name="VALUE">
                                  <block type="variables_get" id="da5*p]}sO:{{|ZE!nhDe">
                                    <field name="VAR" id="xSVSX?qYBxERx4)1(5:3">originalText</field>
                                  </block>
                                </value>
                                <next>
                                  <block type="variables_set" id="yx;qp1@1fC(oiG4c5gZt">
                                    <field name="VAR" id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</field>
                                    <value name="VALUE">
                                      <block type="text_length" id="Jwz33ARDLc!=8:eDagDD">
                                        <value name="VALUE">
                                          <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="RZWm!~Yo4w5)66Gu|Gs_">
                                            <field name="TEXT">abc</field>
                                          </shadow>
                                          <block type="variables_get" id="G2I+np)5qee]q{4)BlN2">
                                            <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                    <next>
                                      <block type="variables_set" id="eAGK[85W)DRaIaN!oMiH">
                                        <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                        <value name="VALUE">
                                          <block type="text_indexOf" id="/@rj}{;VUCJ8O|28^(Hf">
                                            <field name="END">FIRST</field>
                                            <value name="VALUE">
                                              <block type="variables_get" id="}de%ffO*rIt%j6)99pf3">
                                                <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                              </block>
                                            </value>
                                            <value name="FIND">
                                              <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="7MprEQxoWq}#3~Xz:32k">
                                                <field name="TEXT">%0D%0A</field>
                                              </shadow>
                                              <block type="variables_get" id="7)r.X1a~Tee1!dAwZy`!">
                                                <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <next>
                                          <block type="controls_whileUntil" id="4lR}{f])DWKyjt}.(6cc">
                                            <field name="MODE">WHILE</field>
                                            <value name="BOOL">
                                              <block type="logic_compare" id="e`eUWK6kyOU=[/x]M({`">
                                                <field name="OP">GT</field>
                                                <value name="A">
                                                  <block type="variables_get" id="}7HLWRwI(SDg1^@=czoV">
                                                    <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="math_number" id="#y,za{r#@s7Ri.U!9v)A">
                                                    <field name="NUM">0</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO">
                                              <block type="comment" id="38%#2?@btrH6%hebNg3_">
                                                <field name="COMMENT">Wenn nicht erste Zeichen im Text!</field>
                                                <next>
                                                  <block type="controls_if" id="R]}Pl(*eeA:Dh@;{q_CH">
                                                    <value name="IF0">
                                                      <block type="logic_compare" id="l,u?h{)Z-u/OozI,.79G">
                                                        <field name="OP">GT</field>
                                                        <value name="A">
                                                          <block type="variables_get" id="B/K~z.ANK2);I3(uk4Bh">
                                                            <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="|3~K:6jrHq7oxz=fL:Yz">
                                                            <field name="NUM">1</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <statement name="DO0">
                                                      <block type="variables_set" id="{R*X,7K)DA^dq/.~KK7{">
                                                        <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
                                                        <value name="VALUE">
                                                          <block type="text_getSubstring" id="Img0opt.EB#)RM-bp~hw">
                                                            <mutation at1="false" at2="true"></mutation>
                                                            <field name="WHERE1">FIRST</field>
                                                            <field name="WHERE2">FROM_START</field>
                                                            <value name="STRING">
                                                              <block type="variables_get" id="A9h*F{tgJR0y[Q0uv7,=">
                                                                <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                              </block>
                                                            </value>
                                                            <value name="AT2">
                                                              <block type="math_arithmetic" id="([5R[:8Ywn-thKN@r:~}">
                                                                <field name="OP">MINUS</field>
                                                                <value name="A">
                                                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="u@:!j5WimCjV%fG9hPGs">
                                                                    <field name="NUM">1</field>
                                                                  </shadow>
                                                                  <block type="variables_get" id="U0qw,~,2KoaAc37UO{l#">
                                                                    <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                                  </block>
                                                                </value>
                                                                <value name="B">
                                                                  <shadow type="math_number" id="DT#zRSRu1.y^|5Z#G37W">
                                                                    <field name="NUM">1</field>
                                                                  </shadow>
                                                                </value>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </statement>
                                                    <next>
                                                      <block type="variables_set" id="Else^,?QE9TTS.Y%K]W=">
                                                        <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                                                        <value name="VALUE">
                                                          <block type="text_getSubstring" id="e8A7NqY7O!@K(aFlMpV#" inline="false">
                                                            <mutation at1="true" at2="false"></mutation>
                                                            <field name="WHERE1">FROM_START</field>
                                                            <field name="WHERE2">LAST</field>
                                                            <value name="STRING">
                                                              <block type="variables_get" id="|jU0g8+eIgwn_|IB56)@">
                                                                <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                              </block>
                                                            </value>
                                                            <value name="AT1">
                                                              <block type="math_arithmetic" id="F#*%;R9ugmwaaas?WBwG">
                                                                <field name="OP">ADD</field>
                                                                <value name="A">
                                                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="8/I%=/~YReHV]Iwo{}(J">
                                                                    <field name="NUM">1</field>
                                                                  </shadow>
                                                                  <block type="variables_get" id="R0|a}kx2M~SYjPKS5Cc{">
                                                                    <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                                  </block>
                                                                </value>
                                                                <value name="B">
                                                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id=";Q(aJ::90?0?H;-45cgS">
                                                                    <field name="NUM">0</field>
                                                                  </shadow>
                                                                  <block type="variables_get" id="dY33=1IVxkrSH1k1#X6A">
                                                                    <field name="VAR" id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</field>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="variables_set" id="OcJS!-Ku1vQY4)I+r,gc">
                                                            <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                            <value name="VALUE">
                                                              <block type="text_join" id="%%D@nUqB1tt^`?qrUahx">
                                                                <mutation items="3"></mutation>
                                                                <value name="ADD0">
                                                                  <block type="variables_get" id="q]l%0Dpb89BZy1-m[TjM">
                                                                    <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
                                                                  </block>
                                                                </value>
                                                                <value name="ADD1">
                                                                  <block type="variables_get" id="f~POFU0}K4-w]xVc1?,`">
                                                                    <field name="VAR" id="=KxFmb,!C-6!HK%6iSz4">tauschText</field>
                                                                  </block>
                                                                </value>
                                                                <value name="ADD2">
                                                                  <block type="variables_get" id="U77~u,Qfmb2g[O19eHoh">
                                                                    <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </value>
                                                            <next>
                                                              <block type="variables_set" id="lao?KUxF77Si~Xc2j%^{">
                                                                <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                                <value name="VALUE">
                                                                  <block type="text_indexOf" id="[),PN,ZrAW,C/~:K[x[:">
                                                                    <field name="END">FIRST</field>
                                                                    <value name="VALUE">
                                                                      <block type="variables_get" id="6{t:BeVh6=bsQF(zUhYG">
                                                                        <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                                      </block>
                                                                    </value>
                                                                    <value name="FIND">
                                                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="{Vd/Su8uk@lo|:3KMi1L">
                                                                        <field name="TEXT">%0D%0A</field>
                                                                      </shadow>
                                                                      <block type="variables_get" id="r|~fKkGR#@1@G6_GX`-g">
                                                                        <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                                                                      </block>
                                                                    </value>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </next>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </statement>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <value name="RETURN">
                      <block type="variables_get" id=".*DA-:q/GzURSEPH2ZiQ">
                        <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                      </block>
                    </value>
                  </block>
                </xml>
                

                Bei Fragen, fragen.

                Grüße

                R Offline
                R Offline
                robson
                wrote on last edited by
                #56

                @rantanplan sagte in [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen:

                Hallo

                Manchmal ist es notwendig unliebsame Zeichen aus einem Text zu entfernen um diese z.B. in VIS vernünftig darstellen zu können.
                Mit dem folgenden Blockly kann man jedes Zeichen, ganze Wörter oder eine Folge von Steuerzeichen gegen etwas anderes tauschen.
                Forum_TauscheZeichen.png
                Hier der Export:

                <xml xmlns="http://www.w3.org/1999/xhtml">
                  <block type="comment" id="?t^|J^}%io+OnqAwVT4A" x="-237" y="-87">
                    <field name="COMMENT">Beliebige Zeichen tauschen</field>
                    <next>
                      <block type="variables_set" id="-P{_[1=caHEAoB9cP4Qx">
                        <field name="VAR">MeinText</field>
                        <value name="VALUE">
                          <block type="text" id="]-v|)OoSpw-K*Z-|~Z|L">
                            <field name="TEXT">Dieser Text müßte geändert werden</field>
                          </block>
                        </value>
                        <next>
                          <block type="controls_if" id="eO-Yu;zv=:r~yJNHR:iS">
                            <value name="IF0">
                              <block type="logic_negate" id="u@28{:]xG=4a9HU}|/v)">
                                <value name="BOOL">
                                  <block type="text_isEmpty" id="W-_T.2)lUsLG/Z(5zIQN">
                                    <value name="VALUE">
                                      <shadow type="text" id="9LrDM?0xYv?MX-(}2OrI">
                                        <field name="TEXT"></field>
                                      </shadow>
                                      <block type="variables_get" id="B?L(8|(8?-Z7Ao*[F/VM">
                                        <field name="VAR">MeinText</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <statement name="DO0">
                              <block type="variables_set" id="ziw)~y|7*7le5/J*8HC#">
                                <field name="VAR">neuerText</field>
                                <value name="VALUE">
                                  <block type="procedures_callreturn" id="ECH/%?YEFylSUOK._8/K">
                                    <mutation name="changeText">
                                      <arg name="originalText"></arg>
                                      <arg name="suchText"></arg>
                                      <arg name="tauschText"></arg>
                                    </mutation>
                                    <value name="ARG0">
                                      <block type="variables_get" id="Y(bM=~D[D5v)7a#1{`}`">
                                        <field name="VAR">MeinText</field>
                                      </block>
                                    </value>
                                    <value name="ARG1">
                                      <block type="text" id="(iqf|@QE;6:tP0}rbaEj">
                                        <field name="TEXT">ü</field>
                                      </block>
                                    </value>
                                    <value name="ARG2">
                                      <block type="text" id="_{HiLh|2|F3|a#[4lCvX">
                                        <field name="TEXT">ue</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <next>
                                  <block type="variables_set" id="`vGUP!R!*|3sjY~dZXxZ">
                                    <field name="VAR">neuerText</field>
                                    <value name="VALUE">
                                      <block type="procedures_callreturn" id="rvKR.cz9FhImw~YT8:YY">
                                        <mutation name="changeText">
                                          <arg name="originalText"></arg>
                                          <arg name="suchText"></arg>
                                          <arg name="tauschText"></arg>
                                        </mutation>
                                        <value name="ARG0">
                                          <block type="variables_get" id="4r-=T6yu%Y[}Zn!QhpR/">
                                            <field name="VAR">neuerText</field>
                                          </block>
                                        </value>
                                        <value name="ARG1">
                                          <block type="text" id="mbk@+N`6F_eG)N%Jw|2J">
                                            <field name="TEXT">ä</field>
                                          </block>
                                        </value>
                                        <value name="ARG2">
                                          <block type="text" id="OtGH;LSHf;*t,59fJ)5i">
                                            <field name="TEXT">ae</field>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                    <next>
                                      <block type="variables_set" id="3+|QU5[xS;U@Qijfuu@7">
                                        <field name="VAR">neuerText</field>
                                        <value name="VALUE">
                                          <block type="procedures_callreturn" id="~C~TrH*=xX3Xl-l@tg#V">
                                            <mutation name="changeText">
                                              <arg name="originalText"></arg>
                                              <arg name="suchText"></arg>
                                              <arg name="tauschText"></arg>
                                            </mutation>
                                            <value name="ARG0">
                                              <block type="variables_get" id=",eH?bND1?H}TimRX_wnz">
                                                <field name="VAR">neuerText</field>
                                              </block>
                                            </value>
                                            <value name="ARG1">
                                              <block type="text" id="6AWuk;A#5~8;jXas31)I">
                                                <field name="TEXT">ß</field>
                                              </block>
                                            </value>
                                            <value name="ARG2">
                                              <block type="text" id="[M[ZL8Y,u8fNWw|eR|g)">
                                                <field name="TEXT">ss</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <next>
                                          <block type="debug" id="g8IUrYe_.rei!S6]Mc?a">
                                            <field name="Severity">log</field>
                                            <value name="TEXT">
                                              <shadow type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                                <field name="TEXT"></field>
                                              </shadow>
                                              <block type="variables_get" id="^/WzSct]9kWQNOvtqOg/">
                                                <field name="VAR">MeinText</field>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="debug" id="Hme!w3Ag?_DUH%uRzR)U">
                                                <field name="Severity">log</field>
                                                <value name="TEXT">
                                                  <shadow type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                                    <field name="TEXT"></field>
                                                  </shadow>
                                                  <block type="variables_get" id="`v3q2Xw=qC`r6)o/kUEY">
                                                    <field name="VAR">neuerText</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </statement>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                  <block type="procedures_defreturn" id="*?%n[KG5e1!^tNun#Hj5" x="288" y="-87">
                    <mutation>
                      <arg name="originalText"></arg>
                      <arg name="suchText"></arg>
                      <arg name="tauschText"></arg>
                    </mutation>
                    <field name="NAME">changeText</field>
                    <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                    <statement name="STACK">
                      <block type="variables_set" id="LyZ2%lYW+kfm,4)yV8UN">
                        <field name="VAR">Text</field>
                        <value name="VALUE">
                          <block type="variables_get" id="da5*p]}sO:{{|ZE!nhDe">
                            <field name="VAR">originalText</field>
                          </block>
                        </value>
                        <next>
                          <block type="variables_set" id="yx;qp1@1fC(oiG4c5gZt">
                            <field name="VAR">AnzZeichenSuchtext</field>
                            <value name="VALUE">
                              <block type="text_length" id="Jwz33ARDLc!=8:eDagDD">
                                <value name="VALUE">
                                  <shadow type="text" id="RZWm!~Yo4w5)66Gu|Gs_">
                                    <field name="TEXT">abc</field>
                                  </shadow>
                                  <block type="variables_get" id="G2I+np)5qee]q{4)BlN2">
                                    <field name="VAR">suchText</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <next>
                              <block type="variables_set" id="eAGK[85W)DRaIaN!oMiH">
                                <field name="VAR">Stelle</field>
                                <value name="VALUE">
                                  <block type="text_indexOf" id="/@rj}{;VUCJ8O|28^(Hf">
                                    <field name="END">FIRST</field>
                                    <value name="VALUE">
                                      <block type="variables_get" id="}de%ffO*rIt%j6)99pf3">
                                        <field name="VAR">Text</field>
                                      </block>
                                    </value>
                                    <value name="FIND">
                                      <shadow type="text" id="7MprEQxoWq}#3~Xz:32k">
                                        <field name="TEXT">%0D%0A</field>
                                      </shadow>
                                      <block type="variables_get" id="7)r.X1a~Tee1!dAwZy`!">
                                        <field name="VAR">suchText</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <next>
                                  <block type="controls_whileUntil" id="4lR}{f])DWKyjt}.(6cc">
                                    <field name="MODE">WHILE</field>
                                    <value name="BOOL">
                                      <block type="logic_compare" id="e`eUWK6kyOU=[/x]M({`">
                                        <field name="OP">GT</field>
                                        <value name="A">
                                          <block type="variables_get" id="}7HLWRwI(SDg1^@=czoV">
                                            <field name="VAR">Stelle</field>
                                          </block>
                                        </value>
                                        <value name="B">
                                          <block type="math_number" id="#y,za{r#@s7Ri.U!9v)A">
                                            <field name="NUM">0</field>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                    <statement name="DO">
                                      <block type="controls_if" id="PM@Su)b1YOhTZo2qPxB]">
                                        <mutation else="1"></mutation>
                                        <value name="IF0">
                                          <block type="logic_compare" id="l,u?h{)Z-u/OozI,.79G">
                                            <field name="OP">EQ</field>
                                            <value name="A">
                                              <block type="variables_get" id="B/K~z.ANK2);I3(uk4Bh">
                                                <field name="VAR">Stelle</field>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id="|3~K:6jrHq7oxz=fL:Yz">
                                                <field name="NUM">1</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="comment" id="uN{|N4-0EabDJqYE0]@#">
                                            <field name="COMMENT">steht am Textanfang</field>
                                            <next>
                                              <block type="variables_set" id="9?Gy,w.t#1pdl^AOxc#Y">
                                                <field name="VAR">Teil_1</field>
                                                <value name="VALUE">
                                                  <block type="variables_get" id="h(#=bJ`DU%y/Jd9%HR9I">
                                                    <field name="VAR">tauschText</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </next>
                                          </block>
                                        </statement>
                                        <statement name="ELSE">
                                          <block type="variables_set" id="{R*X,7K)DA^dq/.~KK7{">
                                            <field name="VAR">Teil_1</field>
                                            <value name="VALUE">
                                              <block type="text_getSubstring" id="Img0opt.EB#)RM-bp~hw">
                                                <mutation at1="false" at2="true"></mutation>
                                                <field name="WHERE1">FIRST</field>
                                                <field name="WHERE2">FROM_START</field>
                                                <value name="STRING">
                                                  <block type="variables_get" id="A9h*F{tgJR0y[Q0uv7,=">
                                                    <field name="VAR">Text</field>
                                                  </block>
                                                </value>
                                                <value name="AT2">
                                                  <block type="math_arithmetic" id="([5R[:8Ywn-thKN@r:~}">
                                                    <field name="OP">MINUS</field>
                                                    <value name="A">
                                                      <shadow type="math_number" id="u@:!j5WimCjV%fG9hPGs">
                                                        <field name="NUM">1</field>
                                                      </shadow>
                                                      <block type="variables_get" id="U0qw,~,2KoaAc37UO{l#">
                                                        <field name="VAR">Stelle</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <shadow type="math_number" id="DT#zRSRu1.y^|5Z#G37W">
                                                        <field name="NUM">1</field>
                                                      </shadow>
                                                    </value>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                          </block>
                                        </statement>
                                        <next>
                                          <block type="variables_set" id="Else^,?QE9TTS.Y%K]W=">
                                            <field name="VAR">Teil_2</field>
                                            <value name="VALUE">
                                              <block type="text_getSubstring" id="e8A7NqY7O!@K(aFlMpV#" inline="false">
                                                <mutation at1="true" at2="false"></mutation>
                                                <field name="WHERE1">FROM_START</field>
                                                <field name="WHERE2">LAST</field>
                                                <value name="STRING">
                                                  <block type="variables_get" id="|jU0g8+eIgwn_|IB56)@">
                                                    <field name="VAR">Text</field>
                                                  </block>
                                                </value>
                                                <value name="AT1">
                                                  <block type="math_arithmetic" id="F#*%;R9ugmwaaas?WBwG">
                                                    <field name="OP">ADD</field>
                                                    <value name="A">
                                                      <shadow type="math_number" id="8/I%=/~YReHV]Iwo{}(J">
                                                        <field name="NUM">1</field>
                                                      </shadow>
                                                      <block type="variables_get" id="R0|a}kx2M~SYjPKS5Cc{">
                                                        <field name="VAR">Stelle</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <shadow type="math_number" id=";Q(aJ::90?0?H;-45cgS">
                                                        <field name="NUM">0</field>
                                                      </shadow>
                                                      <block type="variables_get" id="dY33=1IVxkrSH1k1#X6A">
                                                        <field name="VAR">AnzZeichenSuchtext</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="variables_set" id="OcJS!-Ku1vQY4)I+r,gc">
                                                <field name="VAR">Text</field>
                                                <value name="VALUE">
                                                  <block type="text_join" id="%%D@nUqB1tt^`?qrUahx">
                                                    <mutation items="3"></mutation>
                                                    <value name="ADD0">
                                                      <block type="variables_get" id="q]l%0Dpb89BZy1-m[TjM">
                                                        <field name="VAR">Teil_1</field>
                                                      </block>
                                                    </value>
                                                    <value name="ADD1">
                                                      <block type="variables_get" id="f~POFU0}K4-w]xVc1?,`">
                                                        <field name="VAR">tauschText</field>
                                                      </block>
                                                    </value>
                                                    <value name="ADD2">
                                                      <block type="variables_get" id="U77~u,Qfmb2g[O19eHoh">
                                                        <field name="VAR">Teil_2</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="variables_set" id="lao?KUxF77Si~Xc2j%^{">
                                                    <field name="VAR">Stelle</field>
                                                    <value name="VALUE">
                                                      <block type="text_indexOf" id="[),PN,ZrAW,C/~:K[x[:">
                                                        <field name="END">FIRST</field>
                                                        <value name="VALUE">
                                                          <block type="variables_get" id="6{t:BeVh6=bsQF(zUhYG">
                                                            <field name="VAR">Text</field>
                                                          </block>
                                                        </value>
                                                        <value name="FIND">
                                                          <shadow type="text" id="{Vd/Su8uk@lo|:3KMi1L">
                                                            <field name="TEXT">%0D%0A</field>
                                                          </shadow>
                                                          <block type="variables_get" id="r|~fKkGR#@1@G6_GX`-g">
                                                            <field name="VAR">suchText</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <value name="RETURN">
                      <block type="variables_get" id=".*DA-:q/GzURSEPH2ZiQ">
                        <field name="VAR">Text</field>
                      </block>
                    </value>
                  </block>
                </xml>
                

                Bei Fragen, fragen.

                Grüße

                Hi @rantanplan ,
                danke für deine Vorlage.

                Ich hatte bei Nutzung nun aber das Problem, dass das erste Zeichen im String dupliziert getauscht wird.
                Bsp: Im String "Wurst" soll das "W" durch ein "D" getauscht werden. Anstatt "Durst" gibt mir das Skript "DDurst" aus.

                Das liegt mMn an folgender Funktion:
                8707825d-500a-4368-8c40-ea4c82daff7f-image.png

                Da "Teil_1" und "tauschText" identisch sind, werden diese hintereinander geschrieben.

                Ich habe dies mit einer einfachen Prüfung behoben.
                b7ef10e1-ab66-4091-a8f7-e4de58d95292-image.png
                Falls "Teil_1" und "tauschtext" identisch sind, dann erstelle Text aus "Teil_1" und Teil_2".
                Falls sie nicht identisch sind, dann erstelle Text aus "Teil_1", "tauschtext" und "Teil_2".

                Ich hoffe, dass hilft dem ein oder anderen.

                rantanplanR 1 Reply Last reply
                0
                • R robson

                  @rantanplan sagte in [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen:

                  Hallo

                  Manchmal ist es notwendig unliebsame Zeichen aus einem Text zu entfernen um diese z.B. in VIS vernünftig darstellen zu können.
                  Mit dem folgenden Blockly kann man jedes Zeichen, ganze Wörter oder eine Folge von Steuerzeichen gegen etwas anderes tauschen.
                  Forum_TauscheZeichen.png
                  Hier der Export:

                  <xml xmlns="http://www.w3.org/1999/xhtml">
                    <block type="comment" id="?t^|J^}%io+OnqAwVT4A" x="-237" y="-87">
                      <field name="COMMENT">Beliebige Zeichen tauschen</field>
                      <next>
                        <block type="variables_set" id="-P{_[1=caHEAoB9cP4Qx">
                          <field name="VAR">MeinText</field>
                          <value name="VALUE">
                            <block type="text" id="]-v|)OoSpw-K*Z-|~Z|L">
                              <field name="TEXT">Dieser Text müßte geändert werden</field>
                            </block>
                          </value>
                          <next>
                            <block type="controls_if" id="eO-Yu;zv=:r~yJNHR:iS">
                              <value name="IF0">
                                <block type="logic_negate" id="u@28{:]xG=4a9HU}|/v)">
                                  <value name="BOOL">
                                    <block type="text_isEmpty" id="W-_T.2)lUsLG/Z(5zIQN">
                                      <value name="VALUE">
                                        <shadow type="text" id="9LrDM?0xYv?MX-(}2OrI">
                                          <field name="TEXT"></field>
                                        </shadow>
                                        <block type="variables_get" id="B?L(8|(8?-Z7Ao*[F/VM">
                                          <field name="VAR">MeinText</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO0">
                                <block type="variables_set" id="ziw)~y|7*7le5/J*8HC#">
                                  <field name="VAR">neuerText</field>
                                  <value name="VALUE">
                                    <block type="procedures_callreturn" id="ECH/%?YEFylSUOK._8/K">
                                      <mutation name="changeText">
                                        <arg name="originalText"></arg>
                                        <arg name="suchText"></arg>
                                        <arg name="tauschText"></arg>
                                      </mutation>
                                      <value name="ARG0">
                                        <block type="variables_get" id="Y(bM=~D[D5v)7a#1{`}`">
                                          <field name="VAR">MeinText</field>
                                        </block>
                                      </value>
                                      <value name="ARG1">
                                        <block type="text" id="(iqf|@QE;6:tP0}rbaEj">
                                          <field name="TEXT">ü</field>
                                        </block>
                                      </value>
                                      <value name="ARG2">
                                        <block type="text" id="_{HiLh|2|F3|a#[4lCvX">
                                          <field name="TEXT">ue</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="variables_set" id="`vGUP!R!*|3sjY~dZXxZ">
                                      <field name="VAR">neuerText</field>
                                      <value name="VALUE">
                                        <block type="procedures_callreturn" id="rvKR.cz9FhImw~YT8:YY">
                                          <mutation name="changeText">
                                            <arg name="originalText"></arg>
                                            <arg name="suchText"></arg>
                                            <arg name="tauschText"></arg>
                                          </mutation>
                                          <value name="ARG0">
                                            <block type="variables_get" id="4r-=T6yu%Y[}Zn!QhpR/">
                                              <field name="VAR">neuerText</field>
                                            </block>
                                          </value>
                                          <value name="ARG1">
                                            <block type="text" id="mbk@+N`6F_eG)N%Jw|2J">
                                              <field name="TEXT">ä</field>
                                            </block>
                                          </value>
                                          <value name="ARG2">
                                            <block type="text" id="OtGH;LSHf;*t,59fJ)5i">
                                              <field name="TEXT">ae</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="variables_set" id="3+|QU5[xS;U@Qijfuu@7">
                                          <field name="VAR">neuerText</field>
                                          <value name="VALUE">
                                            <block type="procedures_callreturn" id="~C~TrH*=xX3Xl-l@tg#V">
                                              <mutation name="changeText">
                                                <arg name="originalText"></arg>
                                                <arg name="suchText"></arg>
                                                <arg name="tauschText"></arg>
                                              </mutation>
                                              <value name="ARG0">
                                                <block type="variables_get" id=",eH?bND1?H}TimRX_wnz">
                                                  <field name="VAR">neuerText</field>
                                                </block>
                                              </value>
                                              <value name="ARG1">
                                                <block type="text" id="6AWuk;A#5~8;jXas31)I">
                                                  <field name="TEXT">ß</field>
                                                </block>
                                              </value>
                                              <value name="ARG2">
                                                <block type="text" id="[M[ZL8Y,u8fNWw|eR|g)">
                                                  <field name="TEXT">ss</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="debug" id="g8IUrYe_.rei!S6]Mc?a">
                                              <field name="Severity">log</field>
                                              <value name="TEXT">
                                                <shadow type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                                  <field name="TEXT"></field>
                                                </shadow>
                                                <block type="variables_get" id="^/WzSct]9kWQNOvtqOg/">
                                                  <field name="VAR">MeinText</field>
                                                </block>
                                              </value>
                                              <next>
                                                <block type="debug" id="Hme!w3Ag?_DUH%uRzR)U">
                                                  <field name="Severity">log</field>
                                                  <value name="TEXT">
                                                    <shadow type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                                      <field name="TEXT"></field>
                                                    </shadow>
                                                    <block type="variables_get" id="`v3q2Xw=qC`r6)o/kUEY">
                                                      <field name="VAR">neuerText</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                    <block type="procedures_defreturn" id="*?%n[KG5e1!^tNun#Hj5" x="288" y="-87">
                      <mutation>
                        <arg name="originalText"></arg>
                        <arg name="suchText"></arg>
                        <arg name="tauschText"></arg>
                      </mutation>
                      <field name="NAME">changeText</field>
                      <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                      <statement name="STACK">
                        <block type="variables_set" id="LyZ2%lYW+kfm,4)yV8UN">
                          <field name="VAR">Text</field>
                          <value name="VALUE">
                            <block type="variables_get" id="da5*p]}sO:{{|ZE!nhDe">
                              <field name="VAR">originalText</field>
                            </block>
                          </value>
                          <next>
                            <block type="variables_set" id="yx;qp1@1fC(oiG4c5gZt">
                              <field name="VAR">AnzZeichenSuchtext</field>
                              <value name="VALUE">
                                <block type="text_length" id="Jwz33ARDLc!=8:eDagDD">
                                  <value name="VALUE">
                                    <shadow type="text" id="RZWm!~Yo4w5)66Gu|Gs_">
                                      <field name="TEXT">abc</field>
                                    </shadow>
                                    <block type="variables_get" id="G2I+np)5qee]q{4)BlN2">
                                      <field name="VAR">suchText</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <next>
                                <block type="variables_set" id="eAGK[85W)DRaIaN!oMiH">
                                  <field name="VAR">Stelle</field>
                                  <value name="VALUE">
                                    <block type="text_indexOf" id="/@rj}{;VUCJ8O|28^(Hf">
                                      <field name="END">FIRST</field>
                                      <value name="VALUE">
                                        <block type="variables_get" id="}de%ffO*rIt%j6)99pf3">
                                          <field name="VAR">Text</field>
                                        </block>
                                      </value>
                                      <value name="FIND">
                                        <shadow type="text" id="7MprEQxoWq}#3~Xz:32k">
                                          <field name="TEXT">%0D%0A</field>
                                        </shadow>
                                        <block type="variables_get" id="7)r.X1a~Tee1!dAwZy`!">
                                          <field name="VAR">suchText</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="controls_whileUntil" id="4lR}{f])DWKyjt}.(6cc">
                                      <field name="MODE">WHILE</field>
                                      <value name="BOOL">
                                        <block type="logic_compare" id="e`eUWK6kyOU=[/x]M({`">
                                          <field name="OP">GT</field>
                                          <value name="A">
                                            <block type="variables_get" id="}7HLWRwI(SDg1^@=czoV">
                                              <field name="VAR">Stelle</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <block type="math_number" id="#y,za{r#@s7Ri.U!9v)A">
                                              <field name="NUM">0</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <statement name="DO">
                                        <block type="controls_if" id="PM@Su)b1YOhTZo2qPxB]">
                                          <mutation else="1"></mutation>
                                          <value name="IF0">
                                            <block type="logic_compare" id="l,u?h{)Z-u/OozI,.79G">
                                              <field name="OP">EQ</field>
                                              <value name="A">
                                                <block type="variables_get" id="B/K~z.ANK2);I3(uk4Bh">
                                                  <field name="VAR">Stelle</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <block type="math_number" id="|3~K:6jrHq7oxz=fL:Yz">
                                                  <field name="NUM">1</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <statement name="DO0">
                                            <block type="comment" id="uN{|N4-0EabDJqYE0]@#">
                                              <field name="COMMENT">steht am Textanfang</field>
                                              <next>
                                                <block type="variables_set" id="9?Gy,w.t#1pdl^AOxc#Y">
                                                  <field name="VAR">Teil_1</field>
                                                  <value name="VALUE">
                                                    <block type="variables_get" id="h(#=bJ`DU%y/Jd9%HR9I">
                                                      <field name="VAR">tauschText</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </next>
                                            </block>
                                          </statement>
                                          <statement name="ELSE">
                                            <block type="variables_set" id="{R*X,7K)DA^dq/.~KK7{">
                                              <field name="VAR">Teil_1</field>
                                              <value name="VALUE">
                                                <block type="text_getSubstring" id="Img0opt.EB#)RM-bp~hw">
                                                  <mutation at1="false" at2="true"></mutation>
                                                  <field name="WHERE1">FIRST</field>
                                                  <field name="WHERE2">FROM_START</field>
                                                  <value name="STRING">
                                                    <block type="variables_get" id="A9h*F{tgJR0y[Q0uv7,=">
                                                      <field name="VAR">Text</field>
                                                    </block>
                                                  </value>
                                                  <value name="AT2">
                                                    <block type="math_arithmetic" id="([5R[:8Ywn-thKN@r:~}">
                                                      <field name="OP">MINUS</field>
                                                      <value name="A">
                                                        <shadow type="math_number" id="u@:!j5WimCjV%fG9hPGs">
                                                          <field name="NUM">1</field>
                                                        </shadow>
                                                        <block type="variables_get" id="U0qw,~,2KoaAc37UO{l#">
                                                          <field name="VAR">Stelle</field>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <shadow type="math_number" id="DT#zRSRu1.y^|5Z#G37W">
                                                          <field name="NUM">1</field>
                                                        </shadow>
                                                      </value>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                            </block>
                                          </statement>
                                          <next>
                                            <block type="variables_set" id="Else^,?QE9TTS.Y%K]W=">
                                              <field name="VAR">Teil_2</field>
                                              <value name="VALUE">
                                                <block type="text_getSubstring" id="e8A7NqY7O!@K(aFlMpV#" inline="false">
                                                  <mutation at1="true" at2="false"></mutation>
                                                  <field name="WHERE1">FROM_START</field>
                                                  <field name="WHERE2">LAST</field>
                                                  <value name="STRING">
                                                    <block type="variables_get" id="|jU0g8+eIgwn_|IB56)@">
                                                      <field name="VAR">Text</field>
                                                    </block>
                                                  </value>
                                                  <value name="AT1">
                                                    <block type="math_arithmetic" id="F#*%;R9ugmwaaas?WBwG">
                                                      <field name="OP">ADD</field>
                                                      <value name="A">
                                                        <shadow type="math_number" id="8/I%=/~YReHV]Iwo{}(J">
                                                          <field name="NUM">1</field>
                                                        </shadow>
                                                        <block type="variables_get" id="R0|a}kx2M~SYjPKS5Cc{">
                                                          <field name="VAR">Stelle</field>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <shadow type="math_number" id=";Q(aJ::90?0?H;-45cgS">
                                                          <field name="NUM">0</field>
                                                        </shadow>
                                                        <block type="variables_get" id="dY33=1IVxkrSH1k1#X6A">
                                                          <field name="VAR">AnzZeichenSuchtext</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                              <next>
                                                <block type="variables_set" id="OcJS!-Ku1vQY4)I+r,gc">
                                                  <field name="VAR">Text</field>
                                                  <value name="VALUE">
                                                    <block type="text_join" id="%%D@nUqB1tt^`?qrUahx">
                                                      <mutation items="3"></mutation>
                                                      <value name="ADD0">
                                                        <block type="variables_get" id="q]l%0Dpb89BZy1-m[TjM">
                                                          <field name="VAR">Teil_1</field>
                                                        </block>
                                                      </value>
                                                      <value name="ADD1">
                                                        <block type="variables_get" id="f~POFU0}K4-w]xVc1?,`">
                                                          <field name="VAR">tauschText</field>
                                                        </block>
                                                      </value>
                                                      <value name="ADD2">
                                                        <block type="variables_get" id="U77~u,Qfmb2g[O19eHoh">
                                                          <field name="VAR">Teil_2</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                  <next>
                                                    <block type="variables_set" id="lao?KUxF77Si~Xc2j%^{">
                                                      <field name="VAR">Stelle</field>
                                                      <value name="VALUE">
                                                        <block type="text_indexOf" id="[),PN,ZrAW,C/~:K[x[:">
                                                          <field name="END">FIRST</field>
                                                          <value name="VALUE">
                                                            <block type="variables_get" id="6{t:BeVh6=bsQF(zUhYG">
                                                              <field name="VAR">Text</field>
                                                            </block>
                                                          </value>
                                                          <value name="FIND">
                                                            <shadow type="text" id="{Vd/Su8uk@lo|:3KMi1L">
                                                              <field name="TEXT">%0D%0A</field>
                                                            </shadow>
                                                            <block type="variables_get" id="r|~fKkGR#@1@G6_GX`-g">
                                                              <field name="VAR">suchText</field>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </next>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </statement>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                      <value name="RETURN">
                        <block type="variables_get" id=".*DA-:q/GzURSEPH2ZiQ">
                          <field name="VAR">Text</field>
                        </block>
                      </value>
                    </block>
                  </xml>
                  

                  Bei Fragen, fragen.

                  Grüße

                  Hi @rantanplan ,
                  danke für deine Vorlage.

                  Ich hatte bei Nutzung nun aber das Problem, dass das erste Zeichen im String dupliziert getauscht wird.
                  Bsp: Im String "Wurst" soll das "W" durch ein "D" getauscht werden. Anstatt "Durst" gibt mir das Skript "DDurst" aus.

                  Das liegt mMn an folgender Funktion:
                  8707825d-500a-4368-8c40-ea4c82daff7f-image.png

                  Da "Teil_1" und "tauschText" identisch sind, werden diese hintereinander geschrieben.

                  Ich habe dies mit einer einfachen Prüfung behoben.
                  b7ef10e1-ab66-4091-a8f7-e4de58d95292-image.png
                  Falls "Teil_1" und "tauschtext" identisch sind, dann erstelle Text aus "Teil_1" und Teil_2".
                  Falls sie nicht identisch sind, dann erstelle Text aus "Teil_1", "tauschtext" und "Teil_2".

                  Ich hoffe, dass hilft dem ein oder anderen.

                  rantanplanR Offline
                  rantanplanR Offline
                  rantanplan
                  wrote on last edited by
                  #57

                  @robson Danke für die Info.
                  Da hast Du aber nach langer, langer, langer Zeit einen Bug gefunden:grin:

                  Habe das Blockly geändert und im ersten Post neu hinterlegt.
                  Hier die Änderung.
                  Zeichentausch2.png

                  Grüße

                  Rantanplan

                  CCU3 / MS Server 2019(VM) / Scripten mit Blockly

                  R N 2 Replies Last reply
                  0
                  • rantanplanR rantanplan

                    @robson Danke für die Info.
                    Da hast Du aber nach langer, langer, langer Zeit einen Bug gefunden:grin:

                    Habe das Blockly geändert und im ersten Post neu hinterlegt.
                    Hier die Änderung.
                    Zeichentausch2.png

                    Grüße

                    R Offline
                    R Offline
                    robson
                    wrote on last edited by robson
                    #58

                    @rantanplan sagte in [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen:

                    @robson Danke für die Info.
                    Da hast Du aber nach langer, langer, langer Zeit einen Bug gefunden:grin:

                    Sehe es als Kompliment für dich und dein Skript an ;)

                    1 Reply Last reply
                    0
                    • rantanplanR rantanplan

                      @robson Danke für die Info.
                      Da hast Du aber nach langer, langer, langer Zeit einen Bug gefunden:grin:

                      Habe das Blockly geändert und im ersten Post neu hinterlegt.
                      Hier die Änderung.
                      Zeichentausch2.png

                      Grüße

                      N Offline
                      N Offline
                      newBroker
                      wrote on last edited by
                      #59

                      Moin zusammen,

                      sagt mal wird der "rechte" Abschnitt benötigt?
                      was macht er in dem Skript?

                      Beste Grüße

                      David G.D 1 Reply Last reply
                      0
                      • N newBroker

                        Moin zusammen,

                        sagt mal wird der "rechte" Abschnitt benötigt?
                        was macht er in dem Skript?

                        Beste Grüße

                        David G.D Online
                        David G.D Online
                        David G.
                        wrote on last edited by
                        #60

                        @newbroker

                        Ja,

                        wird benötigt.
                        Da steckt die haupt Funktion und Logik vom Skript drinnen.
                        Darauf greift der linke Teil während der Verarbeitung zu.

                        Zeigt eure Lovelace-Visualisierung klick
                        (Auch ideal um sich Anregungen zu holen)

                        Meine Tabellen für eure Visualisierung klick

                        N 1 Reply Last reply
                        0
                        • David G.D David G.

                          @newbroker

                          Ja,

                          wird benötigt.
                          Da steckt die haupt Funktion und Logik vom Skript drinnen.
                          Darauf greift der linke Teil während der Verarbeitung zu.

                          N Offline
                          N Offline
                          newBroker
                          wrote on last edited by
                          #61

                          @david-g

                          Dankeschön :-)

                          1 Reply Last reply
                          0
                          • rantanplanR rantanplan

                            Hallo

                            Manchmal ist es notwendig unliebsame Zeichen aus einem Text zu entfernen um diese z.B. in VIS vernünftig darstellen zu können.
                            Mit dem folgenden Blockly kann man jedes Zeichen, ganze Wörter oder eine Folge von Steuerzeichen gegen etwas anderes tauschen.

                            Der von @robson gefundene Bug wurde behoben.

                            Zeichentausch.png

                            Hier der geänderte Export:

                            <xml xmlns="https://developers.google.com/blockly/xml">
                              <variables>
                                <variable id="xSVSX?qYBxERx4)1(5:3">originalText</variable>
                                <variable id=";bO,k;{f-t4YW^V4Yaby">suchText</variable>
                                <variable id="=KxFmb,!C-6!HK%6iSz4">tauschText</variable>
                                <variable id="pF_ac~cY~|C(S.I!U%Uu">MeinText</variable>
                                <variable id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</variable>
                                <variable id="P8$b81v9fsrHHrb+z]g1">Text</variable>
                                <variable id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</variable>
                                <variable id="I;i^c)UORMgY^LOatF[8">neuerText</variable>
                                <variable id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</variable>
                                <variable id="(NMF97xgk;{xp~AH$Ln*">Stelle</variable>
                              </variables>
                              <block type="comment" id="?t^|J^}%io+OnqAwVT4A" x="-237" y="-87">
                                <field name="COMMENT">Beliebige Zeichen tauschen</field>
                                <next>
                                  <block type="variables_set" id="-P{_[1=caHEAoB9cP4Qx">
                                    <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                                    <value name="VALUE">
                                      <block type="text" id="]-v|)OoSpw-K*Z-|~Z|L">
                                        <field name="TEXT">Dieser Text müßte geändert werden.</field>
                                      </block>
                                    </value>
                                    <next>
                                      <block type="controls_if" id="eO-Yu;zv=:r~yJNHR:iS">
                                        <value name="IF0">
                                          <block type="logic_negate" id="u@28{:]xG=4a9HU}|/v)">
                                            <value name="BOOL">
                                              <block type="text_isEmpty" id="W-_T.2)lUsLG/Z(5zIQN">
                                                <value name="VALUE">
                                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="9LrDM?0xYv?MX-(}2OrI">
                                                    <field name="TEXT"></field>
                                                  </shadow>
                                                  <block type="variables_get" id="B?L(8|(8?-Z7Ao*[F/VM">
                                                    <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="variables_set" id="ziw)~y|7*7le5/J*8HC#">
                                            <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                            <value name="VALUE">
                                              <block type="procedures_callreturn" id="ECH/%?YEFylSUOK._8/K">
                                                <mutation name="changeText">
                                                  <arg name="originalText"></arg>
                                                  <arg name="suchText"></arg>
                                                  <arg name="tauschText"></arg>
                                                </mutation>
                                                <value name="ARG0">
                                                  <block type="variables_get" id="Y(bM=~D[D5v)7a#1{`}`">
                                                    <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                                                  </block>
                                                </value>
                                                <value name="ARG1">
                                                  <block type="text" id="(iqf|@QE;6:tP0}rbaEj">
                                                    <field name="TEXT">ü</field>
                                                  </block>
                                                </value>
                                                <value name="ARG2">
                                                  <block type="text" id="_{HiLh|2|F3|a#[4lCvX">
                                                    <field name="TEXT">ue</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="variables_set" id="`vGUP!R!*|3sjY~dZXxZ">
                                                <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                                <value name="VALUE">
                                                  <block type="procedures_callreturn" id="rvKR.cz9FhImw~YT8:YY">
                                                    <mutation name="changeText">
                                                      <arg name="originalText"></arg>
                                                      <arg name="suchText"></arg>
                                                      <arg name="tauschText"></arg>
                                                    </mutation>
                                                    <value name="ARG0">
                                                      <block type="variables_get" id="4r-=T6yu%Y[}Zn!QhpR/">
                                                        <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                                      </block>
                                                    </value>
                                                    <value name="ARG1">
                                                      <block type="text" id="mbk@+N`6F_eG)N%Jw|2J">
                                                        <field name="TEXT">ä</field>
                                                      </block>
                                                    </value>
                                                    <value name="ARG2">
                                                      <block type="text" id="OtGH;LSHf;*t,59fJ)5i">
                                                        <field name="TEXT">ae</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="variables_set" id="3+|QU5[xS;U@Qijfuu@7">
                                                    <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                                    <value name="VALUE">
                                                      <block type="procedures_callreturn" id="~C~TrH*=xX3Xl-l@tg#V">
                                                        <mutation name="changeText">
                                                          <arg name="originalText"></arg>
                                                          <arg name="suchText"></arg>
                                                          <arg name="tauschText"></arg>
                                                        </mutation>
                                                        <value name="ARG0">
                                                          <block type="variables_get" id=",eH?bND1?H}TimRX_wnz">
                                                            <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                                          </block>
                                                        </value>
                                                        <value name="ARG1">
                                                          <block type="text" id="6AWuk;A#5~8;jXas31)I">
                                                            <field name="TEXT">ß</field>
                                                          </block>
                                                        </value>
                                                        <value name="ARG2">
                                                          <block type="text" id="[M[ZL8Y,u8fNWw|eR|g)">
                                                            <field name="TEXT">ss</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <next>
                                                      <block type="debug" id="g8IUrYe_.rei!S6]Mc?a">
                                                        <field name="Severity">log</field>
                                                        <value name="TEXT">
                                                          <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                                            <field name="TEXT"></field>
                                                          </shadow>
                                                          <block type="variables_get" id="^/WzSct]9kWQNOvtqOg/">
                                                            <field name="VAR" id="pF_ac~cY~|C(S.I!U%Uu">MeinText</field>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="debug" id="Hme!w3Ag?_DUH%uRzR)U">
                                                            <field name="Severity">log</field>
                                                            <value name="TEXT">
                                                              <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="d7HPm]yEeu9+?9HT0u|l">
                                                                <field name="TEXT"></field>
                                                              </shadow>
                                                              <block type="variables_get" id="`v3q2Xw=qC`r6)o/kUEY">
                                                                <field name="VAR" id="I;i^c)UORMgY^LOatF[8">neuerText</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </statement>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                              <block type="procedures_defreturn" id="*?%n[KG5e1!^tNun#Hj5" x="288" y="-87">
                                <mutation>
                                  <arg name="originalText" varid="xSVSX?qYBxERx4)1(5:3"></arg>
                                  <arg name="suchText" varid=";bO,k;{f-t4YW^V4Yaby"></arg>
                                  <arg name="tauschText" varid="=KxFmb,!C-6!HK%6iSz4"></arg>
                                </mutation>
                                <field name="NAME">changeText</field>
                                <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                <statement name="STACK">
                                  <block type="variables_set" id=",*Bi*dYY8!8mI7(mg9V.">
                                    <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
                                    <value name="VALUE">
                                      <block type="text" id="|BZm+^ZNZWW}2Oo#`j;?">
                                        <field name="TEXT"></field>
                                      </block>
                                    </value>
                                    <next>
                                      <block type="variables_set" id="w]M[kO6!;:DS!~0O}SHV">
                                        <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                                        <value name="VALUE">
                                          <block type="text" id="LK!;|?K5!yeQYlUax(!P">
                                            <field name="TEXT"></field>
                                          </block>
                                        </value>
                                        <next>
                                          <block type="variables_set" id="LyZ2%lYW+kfm,4)yV8UN">
                                            <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                            <value name="VALUE">
                                              <block type="variables_get" id="da5*p]}sO:{{|ZE!nhDe">
                                                <field name="VAR" id="xSVSX?qYBxERx4)1(5:3">originalText</field>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="variables_set" id="yx;qp1@1fC(oiG4c5gZt">
                                                <field name="VAR" id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</field>
                                                <value name="VALUE">
                                                  <block type="text_length" id="Jwz33ARDLc!=8:eDagDD">
                                                    <value name="VALUE">
                                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="RZWm!~Yo4w5)66Gu|Gs_">
                                                        <field name="TEXT">abc</field>
                                                      </shadow>
                                                      <block type="variables_get" id="G2I+np)5qee]q{4)BlN2">
                                                        <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="variables_set" id="eAGK[85W)DRaIaN!oMiH">
                                                    <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                    <value name="VALUE">
                                                      <block type="text_indexOf" id="/@rj}{;VUCJ8O|28^(Hf">
                                                        <field name="END">FIRST</field>
                                                        <value name="VALUE">
                                                          <block type="variables_get" id="}de%ffO*rIt%j6)99pf3">
                                                            <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                          </block>
                                                        </value>
                                                        <value name="FIND">
                                                          <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="7MprEQxoWq}#3~Xz:32k">
                                                            <field name="TEXT">%0D%0A</field>
                                                          </shadow>
                                                          <block type="variables_get" id="7)r.X1a~Tee1!dAwZy`!">
                                                            <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <next>
                                                      <block type="controls_whileUntil" id="4lR}{f])DWKyjt}.(6cc">
                                                        <field name="MODE">WHILE</field>
                                                        <value name="BOOL">
                                                          <block type="logic_compare" id="e`eUWK6kyOU=[/x]M({`">
                                                            <field name="OP">GT</field>
                                                            <value name="A">
                                                              <block type="variables_get" id="}7HLWRwI(SDg1^@=czoV">
                                                                <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                              </block>
                                                            </value>
                                                            <value name="B">
                                                              <block type="math_number" id="#y,za{r#@s7Ri.U!9v)A">
                                                                <field name="NUM">0</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </value>
                                                        <statement name="DO">
                                                          <block type="comment" id="38%#2?@btrH6%hebNg3_">
                                                            <field name="COMMENT">Wenn nicht erste Zeichen im Text!</field>
                                                            <next>
                                                              <block type="controls_if" id="R]}Pl(*eeA:Dh@;{q_CH">
                                                                <value name="IF0">
                                                                  <block type="logic_compare" id="l,u?h{)Z-u/OozI,.79G">
                                                                    <field name="OP">GT</field>
                                                                    <value name="A">
                                                                      <block type="variables_get" id="B/K~z.ANK2);I3(uk4Bh">
                                                                        <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                                      </block>
                                                                    </value>
                                                                    <value name="B">
                                                                      <block type="math_number" id="|3~K:6jrHq7oxz=fL:Yz">
                                                                        <field name="NUM">1</field>
                                                                      </block>
                                                                    </value>
                                                                  </block>
                                                                </value>
                                                                <statement name="DO0">
                                                                  <block type="variables_set" id="{R*X,7K)DA^dq/.~KK7{">
                                                                    <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
                                                                    <value name="VALUE">
                                                                      <block type="text_getSubstring" id="Img0opt.EB#)RM-bp~hw">
                                                                        <mutation at1="false" at2="true"></mutation>
                                                                        <field name="WHERE1">FIRST</field>
                                                                        <field name="WHERE2">FROM_START</field>
                                                                        <value name="STRING">
                                                                          <block type="variables_get" id="A9h*F{tgJR0y[Q0uv7,=">
                                                                            <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                                          </block>
                                                                        </value>
                                                                        <value name="AT2">
                                                                          <block type="math_arithmetic" id="([5R[:8Ywn-thKN@r:~}">
                                                                            <field name="OP">MINUS</field>
                                                                            <value name="A">
                                                                              <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="u@:!j5WimCjV%fG9hPGs">
                                                                                <field name="NUM">1</field>
                                                                              </shadow>
                                                                              <block type="variables_get" id="U0qw,~,2KoaAc37UO{l#">
                                                                                <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                                              </block>
                                                                            </value>
                                                                            <value name="B">
                                                                              <shadow type="math_number" id="DT#zRSRu1.y^|5Z#G37W">
                                                                                <field name="NUM">1</field>
                                                                              </shadow>
                                                                            </value>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                  </block>
                                                                </statement>
                                                                <next>
                                                                  <block type="variables_set" id="Else^,?QE9TTS.Y%K]W=">
                                                                    <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                                                                    <value name="VALUE">
                                                                      <block type="text_getSubstring" id="e8A7NqY7O!@K(aFlMpV#" inline="false">
                                                                        <mutation at1="true" at2="false"></mutation>
                                                                        <field name="WHERE1">FROM_START</field>
                                                                        <field name="WHERE2">LAST</field>
                                                                        <value name="STRING">
                                                                          <block type="variables_get" id="|jU0g8+eIgwn_|IB56)@">
                                                                            <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                                          </block>
                                                                        </value>
                                                                        <value name="AT1">
                                                                          <block type="math_arithmetic" id="F#*%;R9ugmwaaas?WBwG">
                                                                            <field name="OP">ADD</field>
                                                                            <value name="A">
                                                                              <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id="8/I%=/~YReHV]Iwo{}(J">
                                                                                <field name="NUM">1</field>
                                                                              </shadow>
                                                                              <block type="variables_get" id="R0|a}kx2M~SYjPKS5Cc{">
                                                                                <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                                              </block>
                                                                            </value>
                                                                            <value name="B">
                                                                              <shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id=";Q(aJ::90?0?H;-45cgS">
                                                                                <field name="NUM">0</field>
                                                                              </shadow>
                                                                              <block type="variables_get" id="dY33=1IVxkrSH1k1#X6A">
                                                                                <field name="VAR" id="6,6h67!#*?Hh,1(Sy,@u">AnzZeichenSuchtext</field>
                                                                              </block>
                                                                            </value>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                    <next>
                                                                      <block type="variables_set" id="OcJS!-Ku1vQY4)I+r,gc">
                                                                        <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                                        <value name="VALUE">
                                                                          <block type="text_join" id="%%D@nUqB1tt^`?qrUahx">
                                                                            <mutation items="3"></mutation>
                                                                            <value name="ADD0">
                                                                              <block type="variables_get" id="q]l%0Dpb89BZy1-m[TjM">
                                                                                <field name="VAR" id="Uf:U=$(.HDJ72/VPr1!o">Teil_1</field>
                                                                              </block>
                                                                            </value>
                                                                            <value name="ADD1">
                                                                              <block type="variables_get" id="f~POFU0}K4-w]xVc1?,`">
                                                                                <field name="VAR" id="=KxFmb,!C-6!HK%6iSz4">tauschText</field>
                                                                              </block>
                                                                            </value>
                                                                            <value name="ADD2">
                                                                              <block type="variables_get" id="U77~u,Qfmb2g[O19eHoh">
                                                                                <field name="VAR" id="g[0H+Z8J_%|p]v;tR.p.">Teil_2</field>
                                                                              </block>
                                                                            </value>
                                                                          </block>
                                                                        </value>
                                                                        <next>
                                                                          <block type="variables_set" id="lao?KUxF77Si~Xc2j%^{">
                                                                            <field name="VAR" id="(NMF97xgk;{xp~AH$Ln*">Stelle</field>
                                                                            <value name="VALUE">
                                                                              <block type="text_indexOf" id="[),PN,ZrAW,C/~:K[x[:">
                                                                                <field name="END">FIRST</field>
                                                                                <value name="VALUE">
                                                                                  <block type="variables_get" id="6{t:BeVh6=bsQF(zUhYG">
                                                                                    <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="FIND">
                                                                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="{Vd/Su8uk@lo|:3KMi1L">
                                                                                    <field name="TEXT">%0D%0A</field>
                                                                                  </shadow>
                                                                                  <block type="variables_get" id="r|~fKkGR#@1@G6_GX`-g">
                                                                                    <field name="VAR" id=";bO,k;{f-t4YW^V4Yaby">suchText</field>
                                                                                  </block>
                                                                                </value>
                                                                              </block>
                                                                            </value>
                                                                          </block>
                                                                        </next>
                                                                      </block>
                                                                    </next>
                                                                  </block>
                                                                </next>
                                                              </block>
                                                            </next>
                                                          </block>
                                                        </statement>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </statement>
                                <value name="RETURN">
                                  <block type="variables_get" id=".*DA-:q/GzURSEPH2ZiQ">
                                    <field name="VAR" id="P8$b81v9fsrHHrb+z]g1">Text</field>
                                  </block>
                                </value>
                              </block>
                            </xml>
                            

                            Bei Fragen, fragen.

                            Grüße

                            jahnbesJ Offline
                            jahnbesJ Offline
                            jahnbes
                            wrote on last edited by
                            #62

                            @rantanplan

                            Danke, hat mir sehr geholfen!

                            R 1 Reply Last reply
                            0
                            • jahnbesJ jahnbes

                              @rantanplan

                              Danke, hat mir sehr geholfen!

                              R Offline
                              R Offline
                              RandyAndy
                              wrote on last edited by
                              #63

                              Hi,

                              ich finde das Skript ja cool und hätte es wahrscheinlich nicht hinbekommen. Da hat jemand richtig Arbeit reingesteckt.
                              Ich habe mich auch schon geärgert, dass das nicht im Blockly abgebildet ist, insb. da Javascript das als Boardmittel mitbringt (wie eigentlich jede Programmiersprache).

                              Hier mal ein Link wie ich das gemacht habe:
                              https://forum.iobroker.net/topic/47645/replace-funktion-in-blockly?_=1637252488203

                              Vielleicht auch ein Ansatz für den ein oder anderen

                              Andreas

                              rantanplanR 1 Reply Last reply
                              0
                              • R RandyAndy

                                Hi,

                                ich finde das Skript ja cool und hätte es wahrscheinlich nicht hinbekommen. Da hat jemand richtig Arbeit reingesteckt.
                                Ich habe mich auch schon geärgert, dass das nicht im Blockly abgebildet ist, insb. da Javascript das als Boardmittel mitbringt (wie eigentlich jede Programmiersprache).

                                Hier mal ein Link wie ich das gemacht habe:
                                https://forum.iobroker.net/topic/47645/replace-funktion-in-blockly?_=1637252488203

                                Vielleicht auch ein Ansatz für den ein oder anderen

                                Andreas

                                rantanplanR Offline
                                rantanplanR Offline
                                rantanplan
                                wrote on last edited by rantanplan
                                #64

                                @randyandy sagte in [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen:

                                Hi,

                                ich finde das Skript ja cool und hätte es wahrscheinlich nicht hinbekommen. Da hat jemand richtig Arbeit reingesteckt.
                                Ich habe mich auch schon geärgert, dass das nicht im Blockly abgebildet ist, insb. da Javascript das als Boardmittel mitbringt (wie eigentlich jede Programmiersprache).

                                Ist schon einige Zeit her. Damals gab es noch keinen Js-Block.

                                Rantanplan

                                CCU3 / MS Server 2019(VM) / Scripten mit Blockly

                                R 1 Reply Last reply
                                0
                                • rantanplanR rantanplan

                                  @randyandy sagte in [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen:

                                  Hi,

                                  ich finde das Skript ja cool und hätte es wahrscheinlich nicht hinbekommen. Da hat jemand richtig Arbeit reingesteckt.
                                  Ich habe mich auch schon geärgert, dass das nicht im Blockly abgebildet ist, insb. da Javascript das als Boardmittel mitbringt (wie eigentlich jede Programmiersprache).

                                  Ist schon einige Zeit her. Damals gab es noch keinen Js-Block.

                                  R Offline
                                  R Offline
                                  RandyAndy
                                  wrote on last edited by RandyAndy
                                  #65

                                  @rantanplan

                                  Alles gut, wie gesagt finde es ja cool das man es überhaupt mit Blockly programmiert bekommt. Keine Frage: Hut ab für das Skript.
                                  Und vielleicht braucht man (hoffentlich) irgendwann meine Krücke auch nicht mehr. Eigentlich gehört dies Funktion ins Blockly, alles andere ist Murks.

                                  Andreas

                                  rantanplanR 1 Reply Last reply
                                  0
                                  • R RandyAndy

                                    @rantanplan

                                    Alles gut, wie gesagt finde es ja cool das man es überhaupt mit Blockly programmiert bekommt. Keine Frage: Hut ab für das Skript.
                                    Und vielleicht braucht man (hoffentlich) irgendwann meine Krücke auch nicht mehr. Eigentlich gehört dies Funktion ins Blockly, alles andere ist Murks.

                                    Andreas

                                    rantanplanR Offline
                                    rantanplanR Offline
                                    rantanplan
                                    wrote on last edited by
                                    #66

                                    @randyandy sagte in [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen:

                                    @rantanplan
                                    Und vielleicht braucht man (hoffentlich) irgendwann meine Krücke auch nicht mehr. Eigentlich gehört dies Funktion ins Blockly, alles andere ist Murks.

                                    Andreas

                                    Alles gut. Bin ganz Deiner Meinung.
                                    Ist aber leider so, dass hier Blockly ganz, ganz,.... zuletzt kommt.

                                    Grüße

                                    Rantanplan

                                    CCU3 / MS Server 2019(VM) / Scripten mit Blockly

                                    1 Reply Last reply
                                    0
                                    • David G.D Online
                                      David G.D Online
                                      David G.
                                      wrote on last edited by David G.
                                      #67

                                      Hallo,

                                      ich habe glaube noch einen Bug im Skript gefunden.

                                      Ich habe einen Text wo nach dem Komma die Leerstellen fehlen (Wird so von einem Adapter geliefert.).

                                      Habe mir also gedacht ich suche nach "," und ersetze es mit ", ".

                                      Leider führt dieser Vorgang zum Absturz der Javascript Instanz.

                                      Zeigt eure Lovelace-Visualisierung klick
                                      (Auch ideal um sich Anregungen zu holen)

                                      Meine Tabellen für eure Visualisierung klick

                                      rantanplanR 1 Reply Last reply
                                      0
                                      • David G.D David G.

                                        Hallo,

                                        ich habe glaube noch einen Bug im Skript gefunden.

                                        Ich habe einen Text wo nach dem Komma die Leerstellen fehlen (Wird so von einem Adapter geliefert.).

                                        Habe mir also gedacht ich suche nach "," und ersetze es mit ", ".

                                        Leider führt dieser Vorgang zum Absturz der Javascript Instanz.

                                        rantanplanR Offline
                                        rantanplanR Offline
                                        rantanplan
                                        wrote on last edited by
                                        #68

                                        @david-g sagte in [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen:

                                        Hallo,

                                        ich habe glaube noch einen Bug im Skript gefunden.

                                        Ich habe einen Text wo nach dem Komma die Leerstellen fehlen (Wird so von einem Adapter geliefert.).

                                        Habe mir also gedacht ich suche nach "," und ersetze es mit ", ".

                                        Leider führt dieser Vorgang zum Absturz der Javascript Instanz.

                                        Hallo

                                        Damit generierst Du eine Endlosschleife!!!
                                        Der Text wird bei jedem Durchgang immer von vorne bis hinten durchsucht.
                                        Suche "," und tausche mit ", " findet somit kein Endeund dann steigt die Instanz irgendwann aus.

                                        Tausche das Komma zuerst mit einem Semikolon und dann das Semikolon durch ", ".

                                        Rantanplan

                                        CCU3 / MS Server 2019(VM) / Scripten mit Blockly

                                        David G.D 1 Reply Last reply
                                        1
                                        • rantanplanR rantanplan

                                          @david-g sagte in [Vorlage] Blockly - Beliebiges Zeichen im Text tauschen:

                                          Hallo,

                                          ich habe glaube noch einen Bug im Skript gefunden.

                                          Ich habe einen Text wo nach dem Komma die Leerstellen fehlen (Wird so von einem Adapter geliefert.).

                                          Habe mir also gedacht ich suche nach "," und ersetze es mit ", ".

                                          Leider führt dieser Vorgang zum Absturz der Javascript Instanz.

                                          Hallo

                                          Damit generierst Du eine Endlosschleife!!!
                                          Der Text wird bei jedem Durchgang immer von vorne bis hinten durchsucht.
                                          Suche "," und tausche mit ", " findet somit kein Endeund dann steigt die Instanz irgendwann aus.

                                          Tausche das Komma zuerst mit einem Semikolon und dann das Semikolon durch ", ".

                                          David G.D Online
                                          David G.D Online
                                          David G.
                                          wrote on last edited by
                                          #69

                                          @rantanplan

                                          Das klingt irgendwie logisch.... 🤣

                                          Zeigt eure Lovelace-Visualisierung klick
                                          (Auch ideal um sich Anregungen zu holen)

                                          Meine Tabellen für eure Visualisierung klick

                                          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

                                          500

                                          Online

                                          32.4k

                                          Users

                                          81.5k

                                          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