Comparison of programming languages (string functions): Difference between revisions

Content deleted Content added
Emanuele6 (talk | contribs)
m markup cleanup: remove blanks at end of line
m left: {{codett}}
 
(10 intermediate revisions by 6 users not shown)
Line 119:
|0
|-
| <code>substr(''string'', ''i'', 1)</code><br/><code>string.substr(''i'', 1)</code>
|[[Raku (programming language)|Raku]]<ref name="at2"/>
|0
Line 139:
|0
|-
| <code>string.sub(''string'', ''i'', ''i'')<br/code><br><code>(''string''):sub(''i'', ''i'')</code>
|[[Lua (programming language)|Lua]]<ref name="at1"/>
|1
Line 333:
|[[Objective-C]] (<code>NSString *</code> only)
|-
| <code>LLT(''string<sub>1</sub>'',''string<sub>2</sub>'')<br/code><br><code>LLE(''string<sub>1</sub>'',''string<sub>2</sub>'')<br/code><br><code>LGT(''string<sub>1</sub>'',''string<sub>2</sub>'')<br/code><br><code>LGE(''string<sub>1</sub>'',''string<sub>2</sub>'') </code>
|[[Fortran]]<ref>returns <code>.TRUE.</code> or <code>.FALSE.</code>. These functions are based on the ASCII collating sequence.</ref>
|-
Line 342:
|[[Go (programming language)|Go]]
|-
| <code>string compare ?-nocase? ?-length int? ''string<sub>1</sub>'' ''string<sub>2</sub>''</code>
|[[Tcl]]
|-
Line 395:
! Format !! Languages
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1= =, <>, <, >, <=</code>}} and <code>{{mono|1=>=</code>}}
|[[Pascal (programming language)|Pascal]], [[Object Pascal]] ([[Delphi (software)|Delphi]]), [[OCaml]], [[Seed7]], [[Standard ML]], [[BASIC]], [[Visual Basic (classic)|VB]], [[Visual Basic .NET|VB .NET]], [[F Sharp (programming language)|F#]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1= =, /=, ≠, <, >, <=, ≤</code>}} and <code>{{mono|1=</code>}}; Also: <code>{{mono|1=EQ, NE, LT, LE, GE</code>}} and <code>{{mono|1=GT</code>}}
|[[ALGOL 68]]
|-
| <code>(stringOP? ''string<sub>1</sub>'' ''string<sub>2</sub>'')</code>, where <code>OP</code> can be any of <code>{{mono|1==, -ci=, <, -ci<, >, -ci>, <=, -ci<=, >=</code>}} and <code>{{mono|1=-ci>=</code>}} (operators starting with '<code>-ci</code>' are case-insensitive)
|[[Scheme (programming language)|Scheme]]
|-
| <code>(stringOP ''string<sub>1</sub>'' ''string<sub>2</sub>'')</code>, where <code>OP</code> can be any of <code>{{mono|1==, -ci=, <>, -ci<>, <, -ci<, >, -ci>, <=, -ci<=, >=</code>}} and <code>{{mono|1=-ci>=</code>}} (operators starting with '<code>{{mono|1=-ci</code>}}' are case-insensitive)
|[[Scheme (programming language)|Scheme]] (SRFI 13)
|-
| <code>(stringOP ''string<sub>1</sub>'' ''string<sub>2</sub>'')</code>, where <code>OP</code> can be any of <code>{{mono|1==, -equal, /=, -not-equal, <, -lessp, >, -greaterp, <=, -not-greaterp, >=</code>}} and <code>{{mono|1=-not-lessp</code>}} (the verbal operators are case-insensitive)
|[[Common Lisp]]
|-
| <code>(stringOP ''string<sub>1</sub>'' ''string<sub>2</sub>'')</code>, where <code>OP</code> can be any of <code>{{mono|1==, /=, <, >, <=,</code>}} and <code>{{mono|1=>=</code>}}
|[[ISLISP]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1= =, \=, <, >, <=</code>}} and <code>{{mono|1=>=</code>}}
|[[Rexx]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1= =, ¬=, <, >, <=, >=, ¬<</code>}} and <code>{{mono|1=¬></code>}}
|[[PL/I]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1==, /=, <, >, <=</code>}} and <code>{{mono|1=>=</code>}}
|[[Ada (programming language)|Ada]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1===, /=, <, >, =<</code>}} and <code>{{mono|1=>=</code>}}
|[[Erlang (programming language)|Erlang]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1===, /=, <, >, <=</code>}} and <code>{{mono|1=>=</code>}}
|[[Haskell]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1=''eq'', ''ne'', ''lt'', ''gt'', ''le''</code>}} and <code>{{mono|1=''ge''</code>}}
|[[Perl]], [[Raku (programming language)|Raku]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1===, !=, <, >, <=</code>}} and <code>{{mono|1=>=</code>}}
|[[C++]] (STL), [[C Sharp (programming language)|C#]], [[D (programming language)|D]], [[Go (programming language)|Go]], [[JavaScript]], [[Python (programming language)|Python]], [[PHP]], [[Ruby (programming language)|Ruby]], [[Rust (programming language)|Rust]],<ref name="Rust compare">In Rust, the operators <code>{{mono|1==</code>=}} and <code>{{mono|1=!=</code>}} and the methods <code>eq</code>, <code>ne</code> are implemented by the [https://doc.rust-lang.org/std/primitive.str.html#impl-PartialEq%3Cstr%3E <code>PartialEq</code>] trait, and the operators {{mono|1=<code><</code>}}, <code>></code{{mono|1=>}}, <code>{{mono|1=<=</code>}}, <code>{{mono|1=>=</code>}} and the methods <code>lt</code>, <code>gt</code>, <code>le</code>, <code>ge</code> are implemented by the [https://doc.rust-lang.org/std/primitive.str.html#impl-PartialOrd%3Cstr%3E <code>PartialOrd</code>] trait.</ref> [[Swift (programming language)|Swift]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1=-eq, -ceq, -ne, -cne, -lt, -clt, -gt, -cgt, -le, -cle, -ge,</code>}} and <code>{{mono|1=-cge</code>}} (operators starting with '<code>{{mono|1=c</code>}}' are case-sensitive)
|[[Windows PowerShell]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1===, ~=, <, >, <=</code>}} and <code>{{mono|1=>=</code>}}
|[[Lua (programming language)|Lua]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1==, ~=, <, >, <=</code>}} and <code>{{mono|1=>=</code>}}
|[[Smalltalk]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>{{mono|1===, /=, <, >, <=</code>}} and <code>{{mono|1=>=; Also: .EQ., .NE., .LT., .LE., .GT.</code>}} and <code>{{mono|1=.GE.</code>}}
|[[Fortran]].<ref>The operators use the compiler's default collating sequence.</ref>
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code> where <code>OP</code> can be any of <code>{{mono|1==, <>, <, >, <=, >=</code>}} as well as worded equivalents
| [[COBOL]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code> where <code>OP</code> can be any of <code>{{mono|1===, <>, <, >, <=</code>}} and <code>{{mono|1=>=</code>}}
| [[Cobra (programming language)|Cobra]]
|-
Line 735:
|[[JavaScript]], [[PHP]]
|-
| <code>''string<sub>1</sub>'' == ''string<sub>2</sub>'' or<br/code><br><code>''string<sub>1</sub>'' .EQ. ''string<sub>2</sub>''</code>
|[[Fortran]]
|-
Line 750:
|[[ALGOL 68]], [[Ada (programming language)|Ada]], [[Object Pascal]] ([[Delphi (software)|Delphi]]), [[OCaml]], [[Pascal (programming language)|Pascal]], [[Rexx]], [[Seed7]], [[Standard ML]], [[BASIC]], [[Visual Basic (classic)|VB]], [[Visual Basic .NET|VB .NET]], [[F Sharp (programming language)|F#]], [[Smalltalk]], [[PL/I]], [[COBOL]]
|-
| <code>test ''string<sub>1</sub>'' = ''string<sub>2</sub>'', or<br/code><br><code>[ ''string<sub>1</sub>'' = ''string<sub>2</sub>'' ]</code>
|[[Bourne Shell]]
|-
| <code>''string<sub>1</sub>'' eq ''string<sub>2</sub>''</code>
|[[Perl]], [[Raku (programming language)|Raku]], [[Tcl]]
|-
| <code>''string<sub>1</sub>''.equals(''string<sub>2</sub>'')</code>
Line 762:
|[[C Sharp (programming language)|C#]]
|-
| <code>''string<sub>1</sub>'' -eq ''string<sub>2</sub>'', or<br/code><br><code>[string]::Equals(''string<sub>1</sub>'', ''string<sub>2</sub>'')</code>
|[[Windows PowerShell]]
|-
| <code>[''string<sub>1</sub>'' isEqualToString:''string<sub>2</sub>''], or<br/code><br><code>[''string<sub>1</sub>'' isEqual:''string<sub>2</sub>'']</code>
|[[Objective-C]] (<code>NSString *</code> only)
|-
Line 846:
|returns −1
|-
| <code>index(''string'',''substring''«,''startpos''»)</code><br/><code>''string''.index(''substring'',«,''startpos''»)</code>
|[[Raku (programming language)|Raku]]
|returns Nil
Line 941:
|returns NSNotFound
|-
| <code>string.find(''string'', ''substring'')<br/code><br><code>(''string''):find(''substring'')</code>
|[[Lua (programming language)|Lua]]
|returns nil
|-
| <code>''string'' indexOfSubCollection: ''substring'' startingAt: ''startpos'' ifAbsent: ''aBlock''<br/code><br><code>''string'' findString: ''substring'' startingAt: ''startpos'' </code>
|[[Smalltalk]] ([[Squeak]], [[Pharo]])
|evaluate aBlock which is a block closure (or any object understanding value)<br/>returns 0
|-
| <code>startpos = INDEX(''string'', ''substring'' «,''back''» «, ''kind''»)</code>
Line 1,101:
|raises {{mono|Not_found}}
|-
| <code>position = SCAN (''string'', ''set'' «, ''back''» «, ''kind''») or<br/code><br><code>position = VERIFY (''string'', ''set'' «, ''back''» «, ''kind''»){{ref|Fortran find|[a]}}</code>
|[[Fortran]]
|returns zero
|-
| <code>''string'' indexOf: ''char'' ifAbsent: aBlock<br/code><br><code>''string'' indexOf: ''char''<br/code><br><code>''string'' includes: ''char''</code>
|[[Smalltalk]]
|evaluate <code>aBlock</code> which is a <code>BlockClosure</code> (or any object understanding value)<br/>returns 0<br/>returns <code>true</code> or <code>false</code>
|-
| <code>index(''string'', ''char'', ''startpos'' )</code>
Line 1,264:
|[[C (programming language)|C]]
|-
| <code>string.format(''formatstring'', ''items'')<br/code><br><code>(''formatstring''):format(''items'')</code>
|[[Lua (programming language)|Lua]]
|[[C (programming language)|C]]
Line 1,284:
|[[C (programming language)|C]]
|-
| <code>''formatnumbers'' ⍕ ''items''</code> or <br><code>''formatstring'' ⎕FMT ''items''</code>
|[[APL (programming language)|APL]]
|APL
Line 1,344:
! Format !! Languages
|-
| <code>''string<sub>1</sub>'' '''ne''' ''string<sub>2</sub>'', or </code><br><code>''string<sub>1</sub>'' NE ''string<sub>2</sub>''</code>
|[[ALGOL 68]] – note: the operator "'''ne'''" is literally in '''bold''' type-font.
|-
Line 1,383:
|[[PL/I]]
|-
| <code>test ''string<sub>1</sub>'' != ''string<sub>2</sub>'', or<br/code><br><code>[ ''string<sub>1</sub>'' != ''string<sub>2</sub>'' ]</code>
|[[Bourne Shell]]
|-
| <code>''string<sub>1</sub>'' -ne ''string<sub>2</sub>'', or<br/code><br><code>-not [string]::Equals(''string<sub>1</sub>'', ''string<sub>2</sub>'')</code>
|[[Windows PowerShell]]
|-
Line 1,482:
|[[Common Lisp]]
|-
| <code>(clojure.string/join ''separator'' ''list_of_strings'')<br/code><br><code>(apply str (interpose ''separator'' ''list_of_strings''))</code>
|[[Clojure]]
|-
Line 1,509:
|[[Java (programming language)|Java]] 8+
|-
| <code>&{$OFS=''$separator''; "''$array_of_strings''"}, or<br/code><br><code>''array_of_strings'' -join ''separator''</code>
|[[Windows PowerShell]]
|-
Line 1,518:
|[[Lua (programming language)|Lua]]
|-
| <code><nowiki>{|String streamContents: [ :stream |</nowiki> ''collectionOfAnything'' asStringOn: stream delimiter: ''separator'' <nowiki>]</nowiki><br/code><br><code>''collectionOfAnything'' joinUsing: ''separator''</code>
|[[Smalltalk]] ([[Squeak]], [[Pharo]])
|-
Line 1,584:
! Format !! Languages
|-
|<code>{{codett|string (string'First .. string'First +|ada}} ''n'' - 1)</code>
|[[Ada (programming language)|Ada]]
|-
Line 1,605:
|[[Objective-C]] (<code>NSString *</code> only)
|-
| <code>{{codett|(apply str (take|clojure}} ''n'' ''string''))</code>
|[[Clojure]]
|-
Line 1,623:
|[[Rexx]], [[Erlang (programming language)|Erlang]]
|-
| <code>''string''[0, ''n'']<br/code><br><code>''string''[0..''n'' - 1]</code>
|[[Ruby (programming language)|Ruby]]
|-
Line 1,659:
|[[F Sharp (programming language)|F#]]
|-
| <code>string.sub(''string'', 1, ''n'')<br/code><br><code>(''string''):sub(1, ''n'')</code>
|[[Lua (programming language)|Lua]]
|-
Line 1,764:
|[[Visual Basic .NET|VB .NET]], [[C Sharp (programming language)|C#]], [[Windows PowerShell]], [[F Sharp (programming language)|F#]]
|-
| <code>chars(''string'')</code><br/><code>''string''.chars</code>
|Number of graphemes (NFG)
|[[Raku (programming language)|Raku]]
|-
| <code>codes(''string'')</code><br/><code>''string''.codes</code>
|Number of Unicode code points
|[[Raku (programming language)|Raku]]
Line 1,832:
|[[Swift (programming language)|Swift]] (1.0–1.1)
|-
| <code>string.len(''string'')<br/code><br><code>(''string''):len()<br/code><br><code>#''string''</code>
| <code></code>
|[[Lua (programming language)|Lua]]
Line 1,840:
|[[Smalltalk]]
|-
| <code>LEN(''string''), or </code><br><code>LEN_TRIM(''string'')</code>
| <code></code>
|[[Fortran]]
Line 1,935:
! Format !! Languages
|-
| <code>LCase(''string'') </code>
|[[Visual Basic (classic)|VB]]
|-
| <code>lcase(''string'') </code>
|[[FreeBASIC]]
|-
Line 1,950:
|[[C (programming language)|C]]<ref>operates on one character</ref>
|-
| <code>std.string.toLower(''string'') </code>
|[[D (programming language)|D]]
|-
Line 2,010:
|[[Objective-C]] (<code>NSString *</code> only), [[Swift (programming language)|Swift]] (Foundation)
|-
| <code>string.lower(''string'')<br/code><br><code>(''string''):lower()</code>
|[[Lua (programming language)|Lua]]
|-
Line 2,102:
|
|-
| <code>split ''separator'', ''string'', 2</code><br/><code>''string''.split( ''separator'', 2 )</code>
|[[Raku (programming language)|Raku]]
|Separator does not have to be a regular expression
Line 2,173:
|[[Raku (programming language)|Raku]]
|-
| <code>''string''.replace(''find'', ''replace'', "g") <ref>third parameter is non-standard</ref> or<br/code><br><code>''string''.replace(/''find_regex''/g, ''replace'')<ref name="regex" /></code>
|[[JavaScript]]
|-
Line 2,182:
|[[Bash (Unix shell)|Bash]]
|-
| <code>''string''.replace(''find'', ''replace''), or<br/code><br><code>''string'' -replace ''find_regex'', ''replace''<ref name="regex" /></code>
|[[Windows PowerShell]]
|-
Line 2,194:
|[[Swift (programming language)|Swift]] (Foundation)
|-
| <code>string.gsub(''string'', ''find'', ''replace'')<br/code><br><code>(''string''):gsub(''find'', ''replace'')</code>
|[[Lua (programming language)|Lua]]
|-
Line 2,263:
|[[Perl]] 5, [[Haskell]]
|-
| <code>flip ''string''</code><br/><code>''string''.flip</code>
|[[Raku (programming language)|Raku]]<!-- reverses graphemes -->
|-
Line 2,302:
|[[JavaScript]]
|-
| <code>string.reverse(''string'')<br/code><br><code>(''string''):reverse()</code>
|[[Lua (programming language)|Lua]]
|-
Line 2,395:
|returns −1
|-
| <code>rindex(''string'',''substring''«,''startpos''»)</code><br/><code>''string''.rindex(''substring''«,''startpos''»)</code>
|[[Raku (programming language)|Raku]]
|returns {{mono|Nil}}
Line 2,450:
|raises {{mono|Not_found}}
|-
| <code>string.match(''string'', '.*()'..''substring'')<br/code><br><code>''string'':match('.*()'..''substring'')</code>
|[[Lua (programming language)|Lua]]
|returns {{mono|nil}}
|-
| <code>Ada.Strings.Unbounded.Index(Source => ''string'', Pattern => ''substring'',<br/> Going => Ada.Strings.Backward)</code>
|[[Ada (programming language)|Ada]]
|returns 0
Line 2,561:
|[[Perl]] 5, [[PHP]]
|-
| <code>substr(''string'',*-''n'')</code><br/><code>''string''.substr(*-''n'')</code>
|[[Raku (programming language)|Raku]]
|-
Line 2,585:
|[[OCaml]]<ref name="ReferenceA"/>
|-
| <code>string.sub(''string'', -''n'')<br/code><br><code>(''string''):sub(-''n'')</code>
|[[Lua (programming language)|Lua]]
|-
Line 2,683:
|[[Perl]] 5
|-
| <code>split(''separator'', ''string''«, ''limit''»)</code><br/><code>''string''.split(''separator'', «''limit''»)</code>
|[[Raku (programming language)|Raku]]
|-
Line 2,698:
|[[Erlang (programming language)|Erlang]]
|-
| <code>strings.Split(''string'', ''separator'')<br/code><br><code>strings.SplitN(''string'', ''separator'', ''limit'')</code>
|[[Go (programming language)|Go]]
|-
Line 2,737:
|[[Tcl]]
|-
| <code>(''separator''≠''string'')⊂''string''</code> orin APL2<br><code>''separator''(≠⊆⊢)''string''</code> in APL2 and Dyalog APL 16.0 respectively
|[[APL (programming language)|APL]]
|-
Line 2,810:
|- style="background:#fffeed;"
! Definition
| <code>substring(''string'', ''startpos'', ''endpos'')</code> returns string<br/><code>substr(''string'', ''startpos'', ''numChars'')</code> returns string
|-
! Description
Line 2,840:
|[[AWK]] (changes string), [[Perl]] 5,<ref name="substr2"/><ref name="substr4"/> [[PHP]]<ref name="substr2"/><ref name="substr4"/>
|-
| <code>substr(''string'', ''startpos'', ''numChars'')</code><br/><code>''string''.substr(''startpos'', ''numChars'')</code>
|[[Raku (programming language)|Raku]]<ref name="substr5"/><ref name="substr6"/>
|-
Line 2,852:
|[[Pick Basic]]
|-
| <code>''string''[''startpos'', ''numChars'']<br/code><br><code>''string''[''startpos'' .. ''endpos''-1]<br/code><br><code>''string''[''startpos'' ... ''endpos'']</code>
|[[Ruby (programming language)|Ruby]]<ref name="substr2"/><ref name="substr3"/>
|-
| <code>''string''[''startpos'' .. ''endpos'']<br/code><br><code>''string''[''startpos'' len ''numChars'']</code>
|[[Seed7]]
|-
Line 2,888:
|[[Standard ML]]
|-
| <code>string:sub_string(''string'', ''startpos'', ''endpos'')<br/code><br><code>string:substr(''string'', ''startpos'', ''numChars'')</code>
|[[Erlang (programming language)|Erlang]]
|-
Line 2,906:
|[[F Sharp (programming language)|F#]]
|-
| <code>string.sub(''string'', ''startpos'', ''endpos'')<br/code><br><code>(''string''):sub(''startpos'', ''endpos'')</code>
|[[Lua (programming language)|Lua]]<ref name="substr2"/><ref name="substr3"/>
|-
Line 2,995:
! Format !! Languages
|-
| <code>UCase(''string'') </code>
|[[Visual Basic (classic)|VB]]
|-
| <code>ucase(''string'') </code>
|[[FreeBASIC]]
|-
| <code>toupper(''string'') </code>
|[[AWK]] (changes string)
|-
Line 3,013:
|[[C (programming language)|C]] (operates on one character)
|-
|<code>{{codett|2=c|1=for(size_t i = 0, len = strlen(}}''string''); i&lt; len; i++) ''string''[i] = toupper(''string''[i]);</code><br/><code>{{codett|2=c|1=for (char *c =}} ''string''{{codett|2=c|1=; *c != '\0'; c++) *c = toupper(*c);}}</code>
|[[C (programming language)|C]] (string / char array)
|-
Line 3,037:
|[[Bash (Unix shell)|Bash]]
|-
|<code>[[echo (command)|echo]] "string" <nowiki>|</nowiki> [[tr (program)|tr]] 'a-z' 'A-Z' </code>
|[[Unix]]
|-
| <code>translate(''string'')</code>,<br><code>UPPER orvariables</code><br><code>PARSE UPPER VAR SrcVar DstVar</code>
<code>UPPER variables</code>, or<br/>
<code>PARSE UPPER VAR SrcVar DstVar</code>
|[[Rexx]]
|-
Line 3,071 ⟶ 3,069:
| <code>''string''.toUpperCase()</code>
|[[Java (programming language)|Java]], [[JavaScript]]
|-
| <code>''string''.uppercase()</code>
|[[Kotlin (programming language)|Kotlin]]<ref>{{cite web |title=uppercase - Kotlin Programming Language |url=https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/uppercase.html |website=Kotlin |access-date=9 November 2024 |language=en}}</ref>
|-
| <code>to_upper(''string'')</code>
Line 3,081 ⟶ 3,082:
|[[Objective-C]] (<code>NSString *</code> only), [[Swift (programming language)|Swift]] (Foundation)
|-
| <code>string.upper(''string'')<br/code><br><code>(''string''):upper()</code>
|[[Lua (programming language)|Lua]]
|-
Line 3,167 ⟶ 3,168:
|[[Factor (programming language)|Factor]]
|-
| <code>{{codett|(string-trim '(#\Space #\Tab #\Newline)|lisp}} ''string'')</code>
|[[Common Lisp]]
|-
Line 3,194 ⟶ 3,195:
|[[Erlang (programming language)|Erlang]]
|-
| <code>''string''.strip or </code><br><code>''string''.lstrip or </code><br><code>''string''.rstrip</code>
|[[Ruby (programming language)|Ruby]]
|-
Line 3,203 ⟶ 3,204:
|[[PHP]], [[Raku (programming language)|Raku]]
|-
| <code>[''string'' {{codett|stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]|objc}}</code>
|[[Objective-C]] using [[Cocoa (API)|Cocoa]]
|-
| <code>''string'' withBlanksTrimmed</code><br><code>''string'' withoutSpaces</code><br><code>''string'' withoutSeparators</code>
|[[Smalltalk]] ([[Squeak]], [[Pharo]])<br>[[Smalltalk]]
|-
|<code>strip(string)</code>
|[[SAS System(software)|SAS]]
|-
|<code>string trim ''$string''</code>
|[[Tcl]]
|-
| <code>TRIM(''string'') or </code><br><code>TRIM(ADJUSTL(''string''))</code>
|[[Fortran]]
|-
Line 3,221 ⟶ 3,222:
|[[SQL]]
|-
| <code>TRIM(''string'') or </code><br><code>LTrim(''string'') or </code><br><code>RTrim(''String'')</code>
|[[ColdFusion]]
|-