This language bar is your friend. Select your favorite languages!

Idiom #38 Extract a substring

Find substring t consisting in characters i (included) to j (excluded) of string s.
(character indexes start at 0 unless specified otherwise)

uses Sysutils;
t := s.Substring(i,j-i);
t := copy(s,i+1,j-i);
T : String := S (I .. J - 1);
#include <stdlib.h>
#include <string.h>
char *t=malloc((j-i+1)*sizeof(char));
auto t = s.substr(i, j-i);
var t = s.Substring(i, j);
auto t = s[i .. j];
var t = s.substring(i, j);
t = String.slice(s, i..j-1)
T = string:sub_string(I, J-1).
t := string([]rune(s)[i:j])
t = drop i (take j s)
t = s.substring(i, j);
String t = s.substring(i,j);
t = s:sub(i, j-1)
$t = mb_substr($s, $i, $j-$i, 'UTF-8');
my $chunk = substr("now is the time", $i, $j);
t = s[i:j]
t = s[i..j-1] 
extern crate unicode_segmentation;
use unicode_segmentation::UnicodeSegmentation;
let t = s.graphemes(true).skip(i).take(j - i).collect::<String>();

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

Related idioms