#11 Find or create a Codesys solution for: FUNCTION F_RTrim

v1.0
closed
aliazzz
None
2020-05-01
2019-05-04
aliazzz
No

Truncates all trailing spaces from the specified value and returns the result.
FUNCTION F_RTrim: T_MaxString
VAR_INPUT

VAR_INPUT
    in : T_MaxString;
END_VAR

in: The string to be converted (Type: T_MaxString).

Example:

PROGRAM MAIN
VAR
    sRTrim  : STRING;
    sLRTrim : STRING;
END_VAR

sRTrim := F_RTrim(' trim> ');(* result: ' trim>' *)
sRTrim := F_RTrim('trim> ');(* result: 'trim>' *)
sRTrim := F_RTrim('trim>');(* result: 'trim>' *)
sRTrim := F_RTrim('');(* result: '' *)

sLRTrim := F_RTrim( F_LTrim( ' <trim> '));(* result: '<trim>' *)

Discussion

  • aliazzz

    aliazzz - 2019-05-04
    • summary: F_RTrim --> FUNCTION F_RTrim
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -0,0 +1,28 @@
    +Truncates all trailing spaces from the specified value and returns the result.
    +FUNCTION F_RTrim: T_MaxString
    +VAR_INPUT
    +
    +~~~
    +VAR_INPUT
    +    in : T_MaxString;
    +END_VAR
    +~~~
    +
    +in: The string to be converted (Type: T_MaxString).
    +
    +Example:
    +
    +~~~
    +PROGRAM MAIN
    +VAR
    +    sRTrim  : STRING;
    +    sLRTrim : STRING;
    +END_VAR
    +
    +sRTrim := F_RTrim(' trim> ');(* result: ' trim>' *)
    +sRTrim := F_RTrim('trim> ');(* result: 'trim>' *)
    +sRTrim := F_RTrim('trim>');(* result: 'trim>' *)
    +sRTrim := F_RTrim('');(* result: '' *)
    +
    +sLRTrim := F_RTrim( F_LTrim( ' <trim> '));(* result: '<trim>' *)
    +~~~
    
     
  • aliazzz

    aliazzz - 2019-05-04
    • summary: FUNCTION F_RTrim --> Find or create a Codesys solution for: FUNCTION F_RTrim
     
  • aliazzz

    aliazzz - 2019-05-04
    • status: open --> closed
    • assigned_to: aliazzz
     
  • aliazzz

    aliazzz - 2019-05-05

    Ticket moved from /prj/tcunit4codesys/tickets/8/

     
  • aliazzz

    aliazzz - 2019-05-05

    Ticket moved from /prj/csunit/tickets/11/

     

Log in to post a comment.