Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* 2024/25/2
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

in operator

See also std.algorithm.searching.

Notes:

  • for strings and lists, use the canFind() function (which returns true or false)
  • with dictionaries, you can use the in operator
(1) canFind()
def main():
    s = "C, C++, D, Java, Python"

    if "++" in s:
        print("found")

    # ----------

    li = [8, 5, 1, 3]

    if 5 in li:
        print("found")
import std.stdio;
import std.algorithm.searching;  // canFind()

void main()
{
    string s = "C, C++, D, Java, Python";

    if (s.canFind("++"))
    {
        writeln("found");
    }

    // ----------

    int[] li = [8, 5, 1, 3];

    if (li.canFind(5))
    {
        writeln("found");
    }
}

You can also think of this function as if it were called "contains".

Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2025 June 28, 22:14