str2str


The str2str function strips enclosing ' ' characters and returns the stripped string. If no enclosing ' ' characters are found, the passed string is returned, this function would be employed to strip enclosing ' ' characters that may be present.

Syntax

sNewString = str2str( sString )

bullet.gif    sString is the string to test.

bullet.gif    sNewString is the result of stripping optionally enclosing ' ' characters.

bullet.gif    sNewString = nil if not a string.

Example

The scripts below returns a string enclosed by ' ' to its enclosed string:

str1 = "'Johnny'"

-- string with ' '

Printf("new = %s\n", str2str(str1))

- prints new = Johnny

 

 

str2 = "Johnny"

-- string without ' '

Printf("new = %s\n", str2str(str2))

- prints new = Johnny

 

 

str3 = 53.4

-- not a string

Printf("new = %s\n", str2str(str3))

-- prints new = (nil)

Related Topics

String Type Functions

strstrip


Mira Pro x64 Script User's Guide, v.8.77 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.