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 ]

Is every character a digit?

See also:

(1) isDigit() with all()
def main():
    good = "2025"
    bad = "20xx25"

    print(good.isdigit())  # True
    print(bad.isdigit())  # False
import std.stdio;
import std.ascii; // isDigit()
import std.algorithm.searching; // all()

void main()
{
    string good = "2025";
    string bad = "20xx25";

    bool v1 = good.all!(isDigit); // true
    writeln(v1);

    bool v2 = bad.all!(c => c.isDigit); // false
    writeln(v2);
}

How all() works: it checks if the predicate is true for every element.

Of course, any() also exists. It checks if the predicate is true for any (at least one) element.


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 27, 12:21