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:

    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)

    ...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)

    Girls who put out are tramps. Girls who don’t are ladies. This is, however, a rather archaic usage of the word. Should one of you boys happen upon a girl who doesn’t put out, do not jump to the conclusion that you have found a lady. What you have probably found is a lesbian.
    Fran Lebowitz (b. 1951)