Trimming (computer Programming) - Usage

Usage

Following are examples of trimming a string using several programming languages. All of the implementations shown return a new string and do not alter the original variable.

Example usage Languages
String.Trim C#, VB.NET, Windows PowerShell
string.strip; D
(.trim string) Clojure
sequence trim Factor
(string-trim '(#\Space #\Tab #\Newline) string) Common Lisp
(string-trim string) Scheme
string.trim Java, JavaScript (1.8.1+, Firefox 3.5+)
Trim(String) Pascal, QBasic, Visual Basic, Delphi
string.strip Python
strings.Trim(string, chars) Go
LTRIM(RTRIM(String)) Oracle SQL, T-SQL
strip(string ) REXX
string:strip(string ) Erlang
string.strip Ruby
string =~ s/^\s+//r =~ s/\s+$//r Perl 5
string.trim Perl 6
trim(string) PHP
] Objective-C using Cocoa
string withBlanksTrimmed
string withoutSpaces
string withoutSeparators
Smalltalk (Squeak, Pharo)
Smalltalk
strip(string) SAS
string trim $string Tcl
TRIM(string) or TRIM(ADJUSTL(string)) Fortran
TRIM(string) SQL
TRIM(string) or LTrim(string) or RTrim(String) ColdFusion
String.trim string OCaml 4+

Read more about this topic:  Trimming (computer Programming)

Famous quotes containing the word usage:

    ...Often the accurate answer to a usage question begins, “It depends.” And what it depends on most often is where you are, who you are, who your listeners or readers are, and what your purpose in speaking or writing is.
    Kenneth G. Wilson (b. 1923)

    I am using it [the word ‘perceive’] here in such a way that to say of an object that it is perceived does not entail saying that it exists in any sense at all. And this is a perfectly correct and familiar usage of the word.
    —A.J. (Alfred Jules)

    Pythagoras, Locke, Socrates—but pages
    Might be filled up, as vainly as before,
    With the sad usage of all sorts of sages,
    Who in his life-time, each was deemed a bore!
    The loftiest minds outrun their tardy ages.
    George Gordon Noel Byron (1788–1824)