IBM Support

The difference between the Str and Cstr commands

Troubleshooting


Problem

Both the Str and Cstr commands can be used in an IBM® Rational® Robot GUI script to convert a number to a string. This technote explains the difference between the two commands.

Resolving The Problem

    The Str command adds a white space character at the beginning of the string; the Cstr command does not.

    For example, the Str command converts the number 123 to " 123" whereas the Cstr command converts 123 to "123".

    The inclusion of the white space character can be useful when concatenating the result with another string, for example

    "The number is" & CStr(123)
    results in
    "The number is123"

    whereas

    "The number is" & Str(123)
    would result in
    "The number is 123"

The same effect can be achieved with Cstr command by placing an empty space at the end of the preceding string.



[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Scripting","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2001a;2002;2003","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

115956914

Document Information

More support for:
Rational Robot

Software version:
2001a, 2002, 2003

Operating system(s):
Windows

Document number:
73677

Modified date:
16 June 2018

UID

swg21120268