Programming-Idioms

Implementation
Java

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.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another Java implementation.

Other implementations
int i = Integer.parseInt(s);
i = s.to_i
import "strconv"
i, err  := strconv.Atoi(s) 
#include <cstdlib>
int i = std::atoi(s);
var i = int.parse(s);
import "strconv"
i, err := strconv.ParseInt(s, 10, 0)
i = int(s)
i = Convert.ToInt64(s);
my $i = $s + 0;
let i = s.parse::<i32>().unwrap();
$i = intval($s, 10);
#include <stdlib.h>
int i = atoi(s);
import std.conv;
auto i = s.to!int;
let i: i32 = s.parse().unwrap_or(0);
uses SysUtils;
i := StrToInt(S);
let i = read s :: Integer
(Integer/parseInt s)
i = String.to_integer(s)
I = list_to_integer(S).
let i = match s.parse::<i32>() {
  Ok(i) => i,
  Err(e) => {
    -1
  }
};
i = tonumber(s)
I := Integer'Value (s);
s.toInt
let i = parseInt(s, 10)
(define i (string->number s))
#include <string>
int i = std::stoi(s);
let num : i32 = line.trim().parse()
        .expect(msg: &str);
(setf i (parse-integer s))
read (unit=s,fmt=*) i
s.toInt()
val i = s.toInt()
const i = Number(s);
#include <string>
#include <sstream>
std::stringstream ss(str);
int i;
ss >> i;
Dim myint As Integer = CInt(("123"))
const i = +s
int i = int.Parse(s);
std::string s("123");
int i;
std::from_chars(s.data(), s.data() + s.size(), i, 10);
(Integer. s)