Length of a STRING

  • Hello,


    I have programed the next function "Show_Message" and i need to know the length of the static message received by the function. Now, this length is a parameter, but it will be very interesting to know this length without counting the letters with the editor.


    --->There is some kind of function like "Int a =Length("Text String")" to do that ?


    example CALL: Show_Message(0,"START PROGRAM",13,TRUE)


    DEF Show_Message(nNum:IN,sMsg:OUT,nTam:IN,bAVisible:IN)
    DECL INT nNum
    DECL CHAR sMsg[]
    DECL INT nTam
    DECL BOOL bAVisible
    DECL STATE_T STATE
    INT OFFSET
    INT i


    IF(m_bShowMessages OR bAVisible)THEN


    $MSG_T={VALID FALSE,RELEASE FALSE,TYP #NOTIFY, MODUL[] " ",KEY[] " ", PARAM_TYP #VALUE, PARAM[] " ",DLG_FORMAT[] " ", ANSWER 0}
    $MSG_T.MODUL[]=" "
    FOR i=1 TO nTam STEP +1
    $MSG_T.KEY[i]=sMsg[i]
    ENDFOR
    OFFSET = 0
    SWRITE($MSG_T.PARAM[],STATE,OFFSET,"%d" ,nNum)
    $MSG_T.PARAM_TYP=#VALUE
    $MSG_T.VALID=TRUE


    WHILE $MSG_T.VALID
    WAIT SEC 0.1
    ENDWHILE
    ;INFO: This is necessary for detect the rising edge of the $MSG_T.VALID
    WAIT SEC 0.5
    ENDIF
    END


    Thanks !!

  • Schritt für Schritt zum Roboterprofi!
  • The StrDeclLen(Variable) - Function shows the length of the declared String
    The StrLen(Variable) - Function shows the actual legth of the String


    This Functions are available since Version 5.2...but I'm not shure...


    This function does the same for earlier versions:


    http://www.roboterforum.de/rob…en/msg3735-2.html#msg3735

    Greetings, Irrer Polterer!

    Wie poste ich falsch? Nachdem ich die Suche und die FAQ erfolgreich ignoriert habe, erstelle ich das gleiche Thema in mehreren Unterforen, benutze einen sehr kreativen Titel wie "Hilfe", am Besten noch mit mehreren Ausrufezeichen, und veröffentliche einen so eindeutigen Text, dass sich jeder etwas Anderes darunter vorstellt.


    Life is a beta version. Full of bugs and no Manual.

Erstelle ein Benutzerkonto oder melde dich an um zu kommentieren

Du musst ein Benutzerkonto haben um einen Kommentar hinterlassen zu können

Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Geht einfach!
Neues Benutzerkonto erstellen
Anmelden
Du hast bereits ein Benutzerkonto? Melde dich hier an.
Jetzt anmelden