Implementation
D

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
boolean b = s.matches("[0-9]*");
b := true
for _, c := range s {
	if c < '0' || c > '9' {
		b = false
		break
	}
}
import "strings"
isNotDigit := func(c rune) bool { return c < '0' || c > '9' }
b := strings.IndexFunc(s, isNotDigit) == -1
var b = /^[0-9]*$/.test(s);
var
  S: String;
  C: Char;
  B: Boolean;

  for C in S do
  begin
    B := C in ['0'..'9'];
    if not B then Break;
  end;
import std.ascii;
import std.algorithm;
bool b = s.all!isDigit;
b = s.count("^0-9").zero?
b = s.isdigit()
b = tonumber(s) ~= nil
import Data.Char
b = all isDigit s
let chars_are_numeric: Vec<bool> = s.chars()
				.map(|c|c.is_numeric())
				.collect();
let b = !chars_are_numeric.contains(&false);
let b = s.chars().all(char::is_numeric);
my $b = $s =~ /^\d*$/;
$b = preg_match('/\D/', $s) !== 1;