Content deleted Content added
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
|[[Raku (programming language)|Raku]]<ref name="at2"/>
|0
Line 139:
|0
|-
| <code>string.sub(''string'', ''i'', ''i'')<
|[[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>'')<
|[[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
|[[Tcl]]
|-
Line 395:
! Format !! Languages
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[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
|[[ALGOL 68]]
|-
| <code>(stringOP? ''string<sub>1</sub>'' ''string<sub>2</sub>'')</code>, where <code>OP</code> can be any of
|[[Scheme (programming language)|Scheme]]
|-
| <code>(stringOP ''string<sub>1</sub>'' ''string<sub>2</sub>'')</code>, where <code>OP</code> can be any of
|[[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
|[[Common Lisp]]
|-
| <code>(stringOP ''string<sub>1</sub>'' ''string<sub>2</sub>'')</code>, where <code>OP</code> can be any of
|[[ISLISP]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[Rexx]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[PL/I]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[Ada (programming language)|Ada]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[Erlang (programming language)|Erlang]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[Haskell]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[Perl]], [[Raku (programming language)|Raku]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[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>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[Windows PowerShell]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[Lua (programming language)|Lua]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[Smalltalk]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of
|[[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
| [[COBOL]]
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code> where <code>OP</code> can be any of
| [[Cobra (programming language)|Cobra]]
|-
Line 735:
|[[JavaScript]], [[PHP]]
|-
| <code>''string<sub>1</sub>'' == ''string<sub>2</sub>''
|[[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>''
|[[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>''
|[[Windows PowerShell]]
|-
| <code>[''string<sub>1</sub>'' isEqualToString:''string<sub>2</sub>'']
|[[Objective-C]] (<code>NSString *</code> only)
|-
Line 846:
|returns −1
|-
| <code>index(''string'',''substring''«,''startpos''»)</code><br
|[[Raku (programming language)|Raku]]
|returns Nil
Line 941:
|returns NSNotFound
|-
| <code>string.find(''string'', ''substring'')<
|[[Lua (programming language)|Lua]]
|returns nil
|-
| <code>''string'' indexOfSubCollection: ''substring'' startingAt: ''startpos'' ifAbsent: ''aBlock''<
|[[Smalltalk]] ([[Squeak]], [[Pharo]])
|evaluate aBlock which is a block closure (or any object understanding value)<br
|-
| <code>startpos = INDEX(''string'', ''substring'' «,''back''» «, ''kind''»)</code>
Line 1,101:
|raises {{mono|Not_found}}
|-
| <code>position = SCAN (''string'', ''set'' «, ''back''» «, ''kind''»)
|[[Fortran]]
|returns zero
|-
| <code>''string'' indexOf: ''char'' ifAbsent: aBlock<
|[[Smalltalk]]
|evaluate <code>aBlock</code> which is a <code>BlockClosure</code> (or any object understanding value)<br
|-
| <code>index(''string'', ''char'', ''startpos'' )</code>
Line 1,264:
|[[C (programming language)|C]]
|-
| <code>string.format(''formatstring'', ''items'')<
|[[Lua (programming language)|Lua]]
|[[C (programming language)|C]]
Line 1,284:
|[[C (programming language)|C]]
|-
| <code>''formatnumbers'' ⍕ ''items''</code>
|[[APL (programming language)|APL]]
|APL
Line 1,344:
! Format !! Languages
|-
| <code>''string<sub>1</sub>'' '''ne''' ''string<sub>2</sub>''
|[[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>''
|[[Bourne Shell]]
|-
| <code>''string<sub>1</sub>'' -ne ''string<sub>2</sub>''
|[[Windows PowerShell]]
|-
Line 1,482:
|[[Common Lisp]]
|-
| <code>(clojure.string/join ''separator'' ''list_of_strings'')<
|[[Clojure]]
|-
Line 1,509:
|[[Java (programming language)|Java]] 8+
|-
| <code>&{$OFS=''$separator''; "''$array_of_strings''"}
|[[Windows PowerShell]]
|-
Line 1,518:
|[[Lua (programming language)|Lua]]
|-
| <code><nowiki>{|String streamContents: [ :stream |</nowiki> ''collectionOfAnything'' asStringOn: stream delimiter: ''separator'' <nowiki>]</nowiki><
|[[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'']<
|[[Ruby (programming language)|Ruby]]
|-
Line 1,659:
|[[F Sharp (programming language)|F#]]
|-
| <code>string.sub(''string'', 1, ''n'')<
|[[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
|Number of graphemes (NFG)
|[[Raku (programming language)|Raku]]
|-
| <code>codes(''string'')</code><br
|Number of Unicode code points
|[[Raku (programming language)|Raku]]
Line 1,832:
|[[Swift (programming language)|Swift]] (1.0–1.1)
|-
| <code>string.len(''string'')<
| <code></code>
|[[Lua (programming language)|Lua]]
Line 1,840:
|[[Smalltalk]]
|-
| <code>LEN(''string'')
| <code></code>
|[[Fortran]]
Line 1,935:
! Format !! Languages
|-
| <code>LCase(''string'')
|[[Visual Basic (classic)|VB]]
|-
| <code>lcase(''string'')
|[[FreeBASIC]]
|-
Line 1,950:
|[[C (programming language)|C]]<ref>operates on one character</ref>
|-
| <code>std.string.toLower(''string'')
|[[D (programming language)|D]]
|-
Line 2,010:
|[[Objective-C]] (<code>NSString *</code> only), [[Swift (programming language)|Swift]] (Foundation)
|-
| <code>string.lower(''string'')<
|[[Lua (programming language)|Lua]]
|-
Line 2,102:
|
|-
| <code>split ''separator'', ''string'', 2</code><br
|[[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>
|[[JavaScript]]
|-
Line 2,182:
|[[Bash (Unix shell)|Bash]]
|-
| <code>''string''.replace(''find'', ''replace'')
|[[Windows PowerShell]]
|-
Line 2,194:
|[[Swift (programming language)|Swift]] (Foundation)
|-
| <code>string.gsub(''string'', ''find'', ''replace'')<
|[[Lua (programming language)|Lua]]
|-
Line 2,263:
|[[Perl]] 5, [[Haskell]]
|-
| <code>flip ''string''</code><br
|[[Raku (programming language)|Raku]]<!-- reverses graphemes -->
|-
Line 2,302:
|[[JavaScript]]
|-
| <code>string.reverse(''string'')<
|[[Lua (programming language)|Lua]]
|-
Line 2,395:
|returns −1
|-
| <code>rindex(''string'',''substring''«,''startpos''»)</code><br
|[[Raku (programming language)|Raku]]
|returns {{mono|Nil}}
Line 2,450:
|raises {{mono|Not_found}}
|-
| <code>string.match(''string'', '.*()'..''substring'')<
|[[Lua (programming language)|Lua]]
|returns {{mono|nil}}
|-
| <code>Ada.Strings.Unbounded.Index(Source => ''string'', Pattern => ''substring'',
|[[Ada (programming language)|Ada]]
|returns 0
Line 2,561:
|[[Perl]] 5, [[PHP]]
|-
| <code>substr(''string'',*-''n'')</code><br
|[[Raku (programming language)|Raku]]
|-
Line 2,585:
|[[OCaml]]<ref name="ReferenceA"/>
|-
| <code>string.sub(''string'', -''n'')<
|[[Lua (programming language)|Lua]]
|-
Line 2,683:
|[[Perl]] 5
|-
| <code>split(''separator'', ''string''«, ''limit''»)</code><br
|[[Raku (programming language)|Raku]]
|-
Line 2,698:
|[[Erlang (programming language)|Erlang]]
|-
| <code>strings.Split(''string'', ''separator'')<
|[[Go (programming language)|Go]]
|-
Line 2,737:
|[[Tcl]]
|-
| <code>(''separator''≠''string'')⊂''string''</code>
|[[APL (programming language)|APL]]
|-
Line 2,810:
|- style="background:#fffeed;"
! Definition
| <code>substring(''string'', ''startpos'', ''endpos'')</code> returns string<br
|-
! 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
|[[Raku (programming language)|Raku]]<ref name="substr5"/><ref name="substr6"/>
|-
Line 2,852:
|[[Pick Basic]]
|-
| <code>''string''[''startpos'', ''numChars'']<
|[[Ruby (programming language)|Ruby]]<ref name="substr2"/><ref name="substr3"/>
|-
| <code>''string''[''startpos'' .. ''endpos'']<
|[[Seed7]]
|-
Line 2,888:
|[[Standard ML]]
|-
| <code>string:sub_string(''string'', ''startpos'', ''endpos'')<
|[[Erlang (programming language)|Erlang]]
|-
Line 2,906:
|[[F Sharp (programming language)|F#]]
|-
| <code>string.sub(''string'', ''startpos'', ''endpos'')<
|[[Lua (programming language)|Lua]]<ref name="substr2"/><ref name="substr3"/>
|-
Line 2,995:
! Format !! Languages
|-
| <code>UCase(''string'')
|[[Visual Basic (classic)|VB]]
|-
| <code>ucase(''string'')
|[[FreeBASIC]]
|-
| <code>toupper(''string'')
|[[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< len; i++) ''string''[i] = toupper(''string''[i]);</code><br
|[[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'
|[[Unix]]
|-
| <code>translate(''string'')</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'')<
|[[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
|[[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
|-
|<code>string trim ''$string''</code>
|[[Tcl]]
|-
| <code>TRIM(''string'')
|[[Fortran]]
|-
Line 3,221 ⟶ 3,222:
|[[SQL]]
|-
| <code>TRIM(''string'')
|[[ColdFusion]]
|-
|