trimstr


The trimstr function removes leading and trailing blanks from a string. It does not remove internal blanks.

Syntax

str_new = trimstr( str )

bullet.gif    str is the string to trim.

bullet.gif    str_new is the trimmed string.

Examples

The script below trims leading and trailing blanks but leaves internal blanks intact. The | character is used to mark the beginning and end of the strings:

str = " sdIOPfg*s ss/ ss "

-- a string with leading and trailing blanks

Printf("|%s|\n", str)

-- result: | sdIOPfg*s ss/ ss |

Printf("|%s|\n", trimstr(str))

-- result: |sdIOPfg*s ss/ ss|

Related Topics

Printf.

String Type Functions

lua string library


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