Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Strings > stripblanks

stripblanks

strips / trims leading or trailing or both blanks (and tabs) of strings

Syntax

Txtout = stripblanks(Txt)
Txtout = stripblanks(Txt, notabs)
Txtout = stripblanks(Txt, notabs, trimloc)

Arguments

Txt, Txtout

Texts or matrices of texts, with size(Txtout)==size(Txt).

notabs

a boolean, if %t then tabs are also stripped (default value is %f).

trimloc

an argument which, if trimloc = -1 remove only leading spaces, if trimloc = 1 remove only trailing spaces. default value is 0, which trims both the leading and trailing spaces.

Description

The stripblanks function strips / trims leading or trailing or both blanks (and tabs) of strings.

Examples

a='  123   ';
'!'+a+'!'
'!'+stripblanks(a)+'!'
a=['  123   ',' xyz']
stripblanks(a)

a = msprintf("\t  \tHello world!\t\t")
stripblanks(a,%f)
stripblanks(a,%t)

a = '    hello    ';
'|'+a+'|'
'|'+stripblanks(a,%t,-1)+'|'
'|'+stripblanks(a,%t,0)+'|'
'|'+stripblanks(a,%t,1)+'|'

History

VersionDescription
6.0 New input trimloc added to remove trailing, leading or both spaces.
Report an issue
<< strings Strings strncpy >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 14 15:02:52 CET 2017