Content deleted Content added
Rust trim; tt to code tag |
Rust comparison operators; some references |
||
Line 89:
|-
| <code>''string''.chars().nth(''i'')</code>
|[[Rust (programming language)|Rust]]<ref>In Rust, the [https://doc.rust-lang.org/std/primitive.str.html#method.chars <code>str::chars</code>] method iterates over code points and the [https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.nth <code>std::iter::Iterator::nth</code>] method on iterators returns the zero-indexed nth value from the iterator, or [[option type|<code>None</code>]].</ref>
|[[Rust (programming language)|Rust]]▼
|0
|-
Line 225:
<syntaxhighlight lang="rust">
//Example in Rust
"Hello, World".chars().nth(2); // Some('l')
</syntaxhighlight>
<!-- endsection -->
Line 407:
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>==, !=, <, >, <=</code> and <code>>=</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>==</code> and <code>!=</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 <code><</code>, <code>></code>, <code><=</code>, <code>>=</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]], Ya
|-
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code>, where <code>OP</code> can be any of <code>-eq, -ceq, -ne, -cne, -lt, -clt, -gt, -cgt, -le, -cle, -ge,</code> and <code>-cge</code> (operators starting with '<code>c</code>' are case-sensitive)
Line 429:
| <code>''string<sub>1</sub>'' OP ''string<sub>2</sub>''</code> is available in the syntax, but means comparison of the pointers pointing to the strings, not of the string contents. Use the Compare (integer result) function.
| [[C (programming language)|C]], [[Java (programming language)|Java]]
|-
| <code>''string<sub>1</sub>''.METHOD(''string<sub>2</sub>'')</code> where <code>METHOD</code> is any of <code>eq</code>, <code>ne</code>, <code>gt</code>, <code>lt</code>, <code>ge</code>, <code>le</code>
▲| [[Rust (programming language)|Rust]]<ref name="Rust compare" />
|}
Line 699 ⟶ 702:
|-
| <code>''string<sub>1</sub>'' == ''string<sub>2</sub>''</code>
|[[Python (programming language)|Python]], [[C++]] (STL), [[C Sharp (programming language)|C#]], [[Cobra (programming language)|Cobra]], [[Go (programming language)|Go]], [[JavaScript]] (similarity), [[PHP]] (similarity), [[Ruby (programming language)|Ruby]], [[Rust (programming language)|Rust]],<ref name="Rust compare" /> [[Erlang (programming language)|Erlang]], [[Haskell (programming language)|Haskell]], [[Lua (programming language)|Lua]], [[D (programming language)|D]], [[Mathematica]], [[Swift (programming language)|Swift]], Ya
|-
| <code>''string<sub>1</sub>'' === ''string<sub>2</sub>''</code>
Line 741 ⟶ 744:
|-
| <code>''string<sub>1</sub>''.eq(''string<sub>2</sub>'')</code>
|[[Rust (programming language)|Rust]]<ref name="Rust compare" />
|}
|