How to remove leadin of traling spaces from a string
 

How to remove leadin of traling spaces from a string

Started by satya, 22 April, 2009, 17:28:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

satya

Hi


I want to remove all blank spaces from a string.

for ex: local Abc="              Trial test"

how to remove the leading spaces wich will indeed make the var Abc to hold value "Trial test"

thanks

Eyes says everything,
Its on you how u read em...

HaArD

This will actually strip leading and trailing spaces.

    function trim (s)
      return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
    end

satya


Eyes says everything,
Its on you how u read em...

SMF spam blocked by CleanTalk