import std.stdio;

void main() {
    string s = "world!";
    s = "Hello " ~ s;
    writeln(s);
}


program String_preappend;

{$APPTYPE CONSOLE}

uses
  System.SysUtils;

type
  TStringHelper = record helper for string
    procedure Preappend(str: string);
  end;

{ TStringHelper }

procedure TStringHelper.Preappend(str: string);
begin
  Self := str + self;
end;

begin
  var h: string;

  // with + operator
  h := 'World';
  h := 'Hello ' + h;
  writeln(h);

  // with a function concat
  h := 'World';
  h := concat('Hello ', h);
  writeln(h);

  // with helper
  h := 'World';
  h.Preappend('Hello ');
  writeln(h);
  readln;
end.


var s = "world!"
s = "Hello " + s
print(s)


local :s "world!"
set :s concat( "Hello " s)
!print s


define-syntax-rule
    (set!-string-prepend a before)
    (set! a (string-append before a)))
   → #syntax:set!-string-prepend

(define name "Presley")
    → name
(set!-string-prepend name "Elvis ")
name
    → "Elvis Presley"


import extensions;
import extensions'text;

public program()
{
    var s := "World";
    s := "Hello " + s;
    console.writeLine:s;

    // Alternative way
    var s2 := StringWriter.load("World");
    s2.insert(0, "Hello ");
    console.writeLine:s2;
    console.readChar()
}


(defvar str "bar")
(setq str (concat "foo" str))
str ;=> "foobar"


1> S = "world".
"world"
2> "Hello " ++ S.
"Hello world"


let mutable s = "world!"
s <- "Hello, " + s
printfn "%s" s


/* created by Aykayayciti Earl Lamont Montgomery
April 9th, 2018 */

s = "fun "
s = s + "Falcon"
> s


\ the following functions are commonly native to a Forth system. Shown for completeness

: C+!     ( n addr -- ) dup [email protected] rot + swap c! ;             \ primitive: increment a byte at addr by n

: +PLACE  ( addr1 length addr2 -- )                        \ Append addr1 length to addr2
          2dup 2>r  count + swap move 2r> c+! ;

: PLACE   ( addr1 len addr2 -- )                           \ addr1 and length, placed at addr2 as counted string
          2dup 2>r  1+  swap  move  2r> c! ;

\ Example begins here
: PREPEND ( addr len addr2 -- addr2)
           >R                                              \ push addr2 to return stack
           PAD PLACE                                       \ place the 1st string in PAD
           [email protected]  count PAD +PLACE                            \ append PAD with addr2 string
           PAD count [email protected]   PLACE                            \ move the whole thing back into addr2
           R> ;                                            \ leave a copy of addr2 on the data stack

: writeln ( addr -- ) cr count type ;                      \ syntax sugar for testing


      INTEGER*4 I,TEXT(66)
      DATA TEXT(1),TEXT(2),TEXT(3)/"Wo","rl","d!"/

      WRITE (6,1) (TEXT(I), I = 1,3)
    1 FORMAT ("Hello ",66A2)

      DO 2 I = 1,3
    2   TEXT(I + 3) = TEXT(I)
      TEXT(1) = "He"
      TEXT(2) = "ll"
      TEXT(3) = "o "

      WRITE (6,3) (TEXT(I), I = 1,6)
    3 FORMAT (66A2)
      END


' FB 1.05.0 Win64

Var s = "prepend"
s = "String " + s
Print s
Sleep


Public Sub Main()
Dim sString1 As String = "world!"
Dim sString2 As String = "Hello "

sString1 = sString2 & sString1

Print sString1

End


Prelude> let f = (++" World!")
Prelude> f "Hello"


   s=: 'value'
   s
value
   s=: 'new ',s
   s
new value


// prepend
public class Prepend {
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder("world");
        sb.insert(0, "Hello, ");
        System.out.println(sb);
    }
}


// No built-in prepend
var s=", World"
s = "Hello" + s
print(s);


    s: "world!"
"world!"
    "Hello " , s
"Hello world!"


// version 1.0.6

fun main(args: Array<String>) {
    var s = "Obama"
    s = "Barack " + s
    println(s)

    // It's also possible to use this standard library function
    // though this is not what it's really intended for
    var t = "Trump"
    t = t.prependIndent("Donald ")
    println(t)
}


{def str World}
-> str

Hello, {str}
-> Hello, World


local(x = ', World!')
#x->merge(1,'Hello')
#x // Hello, World!


> (set s "world")
"world"
> (++ "hello " s)
"hello world"


str = "world!"
put "Hello " before str
put str
-- "Hello world!"


put "world" into x
put "hello" before x
put x // hello world


Module PrependString {
      A$="Hello"
      A$+=" World"
      Print A$
}
PrependString


l := " World";
m := cat("Hello", l);
n := "Hello"||l;
o := `||`("Hello", l);


a = "any text value";
a =  "another string literal" <> a  (* using concatenation (no built-in prepend) *)


:- module string_prepend.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module string.
main(!IO) :-
    S = "World!\n",
    io.write_string("Hello " ++ S, !IO).


s1 = " a test"
s1 = "this is" + s1

println s1


/**
 <doc>
String prepend in Neko
</doc>
**/

var str = ", world"
str = "Hello" + str
$print(str, "\n")


(setq str "bar")
(push "foo" str)
(println str)


# Direct way.
var str1, str2 = "12345678"
str1 = "0" & str1
echo str1

# Using "insert".
str2.insert("0")
echo str2


class Prepend  {
  function : Main(args : String[]) ~ Nil {
    s := "world!";
    "Hello {$s}"->PrintLine();
  }
}


let () =
  let s = ", world" in
  let s = "Hello" ^ s in
  print_endline s


program StringPrepend;
{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  { you can add units after this };

var
  s: String = ' World !';
begin
  s := 'Hello' + s;
  WriteLn(S);
  ReadLn;
end.


use strict;
use warnings;
use feature ':all';

# explicit concatentation
$_ = 'bar';
$_ = 'Foo' . $_;
say;

# lvalue substr
$_ = 'bar';
substr $_, 0, 0, 'Foo';
say;

# interpolation as concatenation
# (NOT safe if concatenate sigils)
$_ = 'bar';
$_ = "Foo$_";
say;


go =>

  S = "123456789",
  println(S),
  S := "A" ++ S,
  println(S),

  % append
  append("B",S,T),
  S := T,
  println(S),

  % insert at position
  S := insert(S,1,'C'), % note: must be a char to keep it a proper string
  println(S),
  % insert many characters
  S := insert_all(S,1,"DE"),
  println(S),
  nl.


(setq Str1 "12345678!")
(setq Str1 (pack "0" Str1))
(println Str1)


Pre_Cat: procedure options (main); /* 2 November 2013 */
   declare s character (100) varying;
   s = ' bowl';
   s = 'dust' || s;
   put (s);
end Pre_Cat;


\def\prepend#1#2{% #1=string  #2=macro containing a string
	\def\tempstring{#1}%
	\expandafter\expandafter\expandafter
	\def\expandafter\expandafter\expandafter
	#2\expandafter\expandafter\expandafter
	{\expandafter\tempstring#2}%
}
\def\mystring{world!}
\prepend{Hello }\mystring
Result : \mystring
\bye


$str = "World!"
$str = "Hello, " + $str
$str


:- op(200, xfx, user:(=+)).

%% +Prepend =+ +Chars
%
%    Will destructively update Chars
%    So that Chars = Prepend prefixed to Chars.
%    eazar001 in ##prolog helped refine this approach.

[X|Xs] =+ Chars :-
  append(Xs, Chars, Rest),
  nb_setarg(2, Chars, Rest),
  nb_setarg(1, Chars, X).


S$ = " World!"
S$ = "Hello" + S$
If OpenConsole()
  PrintN(S$)

  Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input()
  CloseConsole()
EndIf


#!/usr/bin/env python
# -*- coding: utf-8 -*-

s = "12345678"
s = "0" + s  # by concatenation
print(s)


s$ = "prepend"
s$ = "String " + s$
PRINT s$


$ "with a rubber duck."
$ "One is never alone "
swap join
echo$


;there is no built-in way to set! prepend in racket
(define str "foo")
(set! str (string-append "bar " str))
(displayln str)

;but you can create a quick macro to solve that problem
(define-syntax-rule (set-prepend! str value)
  (set! str (string-append value str)))

(define macrostr " bar")
(set-prepend! macrostr "foo")
(displayln macrostr)


# explicit concatentation
$_ = 'byte';
$_ = 'kilo' ~ $_;
.say;

# interpolation as concatenation
$_ = 'buck';
$_ = "mega$_";
.say;

# lvalue substr
$_ = 'bit';
substr-rw($_,0,0) = 'nano';
.say;

# regex substitution
$_ = 'fortnight';
s[^] = 'micro';
.say;

# reversed append assignment
$_ = 'cooper';
$_ [R~]= 'mini';
.say;


Red []
s: "world"
insert s "hello "
print s


zz= 'llo world!'          /*─────────────── using literal abuttal.────────────*/
zz= 'he'zz                /*This won't work if the variable name is  X  or  B */
say zz

gg = "llo world!"         /*─────────────── using literal concatenation.──────*/
gg = 'he' || gg
say gg

aString= 'llo world!'     /*─────────────── using variable concatenation.─────*/
bString= "he"
aString= bString || aString
say aString


aString = "World!"
bString = "Hello, " + aString
see bString + nl


str = "llo world"
str.prepend("He")
p str #=> "Hello world"


let mut s = "World".to_string();
s.insert_str(0, "Hello ");
println!("{}", s);


  val s = "World" // Immutables are recommended   //> s  : String = World
  val f2 = () => ", " //Function assigned to variable
                                                  //> f2  : () => String = <function0>
  val s1 = "Hello" + f2() + s                     //> s1  : String = Hello, World
  println(s1);                                    //> Hello, World


$ include "seed7_05.s7i";

const proc: main is func
  local
    var string: s is "world!";
  begin
    s := "Hello " & s;
    writeln(s);
  end func;


var str = 'llo!';
str.sub!(/^/, 'He');
say str;


    s = ', World!'
    OUTPUT = s = 'Hello' s
END


> val s="any text" ;
val s = "any text": string
> "prepended " ^ s;
val it = "prepended any text": string


sca s="Vita Brevis"
sca s="Ars Longa "+s
di s

Ars Longa Vita Brevis


var str = ", World"
str = "Hello \(str)"
println(str)


decl string s

# set s to "world"
set s "world"

# prepend "hello "
set s (+ "hello " s)

# outputs "hello world"
out s endl console


Function StringPrepend()
Dim s As String
s = "bar"
s = "foo" & s
Debug.Print s
End Function


var s = "world!"
s = "Hello, " + s
System.print(s)


Dim s As String = "bar"
s = "foo" + s
MsgBox(s)


include xpllib;
char S, T(80);
[S:= "world!";
S:= StrCat(StrCopy(T,"Hello, "), S);
Text(0, S);
]


s:="bar"; s="foo" + s;           s.println();
s:="bar"; s=String("foo",s);     s.println();
s:="bar"; s="%s%s".fmt("foo",s); s.println();
   // a Data is a byte buffer/editor:
s:=Data(Void,"bar").insert(0,"foo").text; s.println();


F stripchars(s, chars)
   R s.filter(c -> c !C @chars).join(‘’)

print(stripchars(‘She was a soul stripper. She took my heart!’, ‘aei’))


*        Strip a set of characters from a string  07/07/2016
STRIPCH  CSECT
         USING  STRIPCH,R13        base register
         B      72(R15)            skip savearea
         DC     17F'0'             savearea
         STM    R14,R12,12(R13)    prolog
         ST     R13,4(R15)         " <-
         ST     R15,8(R13)         " ->
         LR     R13,R15            " addressability
         LA     R1,PARMLIST        parameter list
         BAL    R14,STRIPCHR       c3=stripchr(c1,c2)
         LA     R2,PG              @pg
         LH     R3,C3              length(c3)
         LA     R4,C3+2            @c3
         LR     R5,R3              length(c3)
         MVCL   R2,R4              pg=c3
         XPRNT  PG,80              print buffer
         L      R13,4(0,R13)       epilog
         LM     R14,R12,12(R13)    " restore
         XR     R15,R15            " rc=0
         BR     R14                exit
PARMLIST DC     A(C3)              @c3
         DC     A(C1)              @c1
         DC     A(C2)              @c2
C1       DC     H'43',CL62'She was a soul stripper. She took my heart!'
C2       DC     H'3',CL14'aei'     c2      [varchar(14)]
C3       DS     H,CL62             c3      [varchar(62)]
PG       DC     CL80' '            buffer  [char(80)]
*------- stripchr -----------------------------------------------------
STRIPCHR L      R9,0(R1)           @parm1
         L      R2,4(R1)           @parm2
         L      R3,8(R1)           @parm3
         MVC    PHRASE(64),0(R2)   phrase=parm2
         MVC    REMOVE(16),0(R3)   remove=parm3
         SR     R8,R8              k=0
         LA     R6,1               i=1
LOOPI    CH     R6,PHRASE          do i=1 to length(phrase)
         BH     ELOOPI             "
         LA     R4,PHRASE+1          @phrase
         AR     R4,R6                +i
         MVC    CI(1),0(R4)          ci=substr(phrase,i,1)
         MVI    OK,X'01'             ok='1'B
         LA     R7,1                 j=1
LOOPJ    CH     R7,REMOVE            do j=1 to length(remove)
         BH     ELOOPJ               "
         LA     R4,REMOVE+1            @remove
         AR     R4,R7                  +j
         MVC    CJ,0(R4)               cj=substr(remove,j,1)
         CLC    CI,CJ                  if ci=cj
         BNE    CINECJ                 then
         MVI    OK,X'00'                 ok='0'B
         B      ELOOPJ                   leave j
CINECJ   LA     R7,1(R7)               j=j+1
         B      LOOPJ                end do j
ELOOPJ   CLI    OK,X'01'             if ok
         BNE    NOTOK                then
         LA     R8,1(R8)               k=k+1
         LA     R4,RESULT+1            @result
         AR     R4,R8                  +k
         MVC    0(1,R4),CI             substr(result,k,1)=ci
NOTOK    LA     R6,1(R6)           i=i+1
         B      LOOPI              end do i
ELOOPI   STH    R8,RESULT          length(result)=k
         MVC    0(64,R9),RESULT    return(result)
         BR     R14                return to caller
CI       DS     CL1                ci      [char(1)]
CJ       DS     CL1                cj      [char(1)]
OK       DS     X                  ok      [boolean]
PHRASE   DS     H,CL62             phrase  [varchar(62)]
REMOVE   DS     H,CL14             remove  [varchar(14)]
RESULT   DS     H,CL62             result  [varchar(62)]
*        ----   -------------------------------------------------------
         YREGS
         END    STRIPCH


		org	100h
		jmp	demo
		;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		;;; Strip a set of chracters from a string, in place.
		;;; Input:
		;;;   DE = $-terminated string to be stripped
		;;;   HL = $-terminated string containing characters to strip
stripchars:	push	h	; Store characters to strip on stack.
		mov	b,d	; Copy input string pointer to BC. This will be
		mov	c,e	; the target pointer.
stripchr:	ldax	d	; Copy current character from [DE] to [BC]
		stax	b
		cpi	'$'	; Done?
		jz	stripdone
		pop	h	; Get string of characters to strip.
		push 	h
stripsrch:	mvi	a,'$'	; At the end?
		cmp	m
		jz	srchdone
		ldax	d	; Does it match the character in the input?
		cmp	m
		jz	srchfound
		inx	h	; Look at next character to strip
		jmp	stripsrch
srchfound:	dcx	b	; Found: copy next character over it later.
srchdone:	inx	b	; Increment both pointers
		inx	d
		jmp	stripchr
stripdone:	pop	h	; Remove temporary variable from stack
		ret		; Done
		;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
demo:		lxi	d,string	; Strip from the string,
		lxi	h,remove	; the characters to remove.
		call	stripchars
		lxi	d,string	; Print the result.
		mvi	c,9
		jmp	5
string:		db	'She was a soul stripper. She took my heart!$'
remove:		db	'aei$'


		bits	16
		cpu	8086
section		.text
		org	100h
		jmp	demo
		;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		;;; Strip a set of characters from a string, in place.
		;;; Input:
		;;;    DS:DI = $-terminated string to be stripped.
		;;;    DS:SI = $-terminated string containing chars to strip
stripchars:	mov	bx,di	; Copy string ptr to use as target ptr
		mov	dx,si	; Copy ptr to characters to strip
.char:		mov	al,[di]	; Copy character
		mov	[bx],al
		cmp	al,'$'	; Done?
		je	.done
		mov	si,dx	; See if character should be stripped
.search:	mov	ah,[si]
		cmp	ah,'$'	; End of characters to strip?
		je	.srchdone
		cmp	ah,al	; Does it match the current character?
		je	.srchfound
		inc	si	; Try next character
		jmp	.search
.srchfound:	dec	bx	; Found - decrement target pointer
.srchdone:	inc	bx	; Increment both pointers
		inc	di
		jmp	.char
.done:		ret
		;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
demo:		mov	di,string	; Strip from the string,
		mov	si,remove	; the characters to remove.
		call	stripchars
		mov	dx,string	; Print the result
		mov	ah,9
		int	21h
		ret
section		.data
string:		db	'She was a soul stripper. She took my heart!$'
remove:		db	'aei$'


PROC Strip(CHAR ARRAY text,chars,res)
  BYTE i,j,size,found
  CHAR c

  size=0
  FOR i=1 TO text(0)
  DO
    c=text(i) found=0
    FOR j=1 TO chars(0)
    DO
      IF c=chars(j) THEN
        found=1 EXIT
      FI
    OD
    IF found=0 THEN
      size==+1
      res(size)=c
    FI
  OD
  res(0)=size
RETURN

PROC Main()
  CHAR ARRAY
    text="She was a soul stripper. She took my heart!",
    chars="aei", result(255)

  Strip(text,chars,result)
  PrintE("String to be stripped:")
  PrintF("""%S""%E%E",text)
  PrintE("Characters to be stripped:")
  PrintF("""%S""%E%E",chars)
  PrintE("Stripped string:")
  PrintF("""%S""%E%E",result)
RETURN


with Ada.Text_IO;

procedure Strip_Characters_From_String is

   function Strip(The_String: String; The_Characters: String)
                  return String is
      Keep:   array (Character) of Boolean := (others => True);
      Result: String(The_String'Range);
      Last:   Natural := Result'First-1;
   begin
      for I in The_Characters'Range loop
         Keep(The_Characters(I)) := False;
      end loop;
      for J in The_String'Range loop
         if Keep(The_String(J)) then
            Last := Last+1;
            Result(Last) := The_String(J);
         end if;
      end loop;
      return Result(Result'First .. Last);
   end Strip;

   S: String := "She was a soul stripper. She took my heart!";

begin -- main
   Ada.Text_IO.Put_Line(Strip(S, "aei"));
end Strip_Characters_From_String;


text
stripchars1(data b, text w)
{
    integer p;

    p = b.look(0, w);
    while (p < ~b) {
        b.delete(p);
        p += b.look(p, w);
    }

     b;
}

text
stripchars2(data b, text w)
{
    b.drop(w);
}

integer
main(void)
{
    o_text(stripchars1("She was a soul stripper. She took my heart!", "aei"));
    o_newline();

    o_text(stripchars2("She was a soul stripper. She took my heart!", "aei"));
    o_newline();

    return 0;
}


#!/usr/local/bin/a68g --script #

PROC strip chars = (STRING mine, ore)STRING: (
  STRING out := "";
  FOR i FROM LWB mine TO UPB mine DO
    IF NOT char in string(mine[i], LOC INT, ore) THEN
      out +:= mine[i]
    FI
  OD;
  out[@LWB mine]
);

printf(($gl$,stripchars("She was a soul stripper. She took my heart!","aei")))


begin
    % returns s with the characters in remove removed                         %
    %     as all strings in Algol W are fixed length, the length of remove    %
    %     must be specified in removeLength                                   %
    string(256) procedure stripCharacters( string(256) value s, remove
                                         ; integer     value removeLength
                                         ) ;
    begin
        string(256) resultText;
        integer     tPos;
        resultText := " ";
        tPos := 0;
        for sPos := 0 until 255 do begin
            logical   keepCharacter;
            string(1) c;
            c             := s( sPos // 1 );
            keepCharacter := true;
            for rPos := 0 until removeLength - 1 do begin
                if remove( rPos // 1 ) = c then begin
                    % have a character that should be removed                 %
                    keepCharacter := false;
                    goto endSearch
                end if_have_a_character_to_remove ;
            end for_rPos ;
endSearch:
            if keepCharacter then begin
                resultText( tPos // 1 ) := c;
                tPos                    := tPos + 1
            end if_keepCharacter
        end for_sPos ;
        resultText
    end stripCharacters ;
    % task test case                                                          %
    begin
        string(256) ex, stripped;
        ex       := "She was a soul stripper. She took my heart!";
        stripped := stripCharacters( ex, "aei", 3 );
        write( "text: ",       ex( 0 // 64 ) );
        write( "  ->: ", stripped( 0 // 64 ) )
    end
end.


'She was a soul stripper. She took my heart!' ~ 'aei'


stripChar("She was a soul stripper. She took my heart!", "aei")

on stripChar(str, chrs)
    tell AppleScript
        set oldTIDs to text item delimiters
        set text item delimiters to characters of chrs
        set TIs to text items of str
        set text item delimiters to ""
        set str to TIs as string
        set text item delimiters to oldTIDs
    end tell
    return str
end stripChar


100  LET S$ = "SHE WAS A SOUL STRIPPER. SHE TOOK MY HEART!"
110  LET RM$ = "AEI"
120  GOSUB 200STRIPCHARS
130  PRINT SC$
190  END
200  REM
210  REM STRIPCHARS
220  REM
230  LET SC$ = ""
240  LET SL =  LEN (S$)
250  IF SL = 0 THEN  RETURN
260  FOR SI = 1 TO SL
270  LET SM$ =  MID$ (S$,SI,1)
280  FOR SJ = 1 TO  LEN (RM$)
290  LET SR$ =  MID$ (RM$,SJ,1)
300  LET ST = SR$ <  > SM$
310  IF ST THEN  NEXT SJ
320  IF ST THEN SC$ = SC$ + SM$
330  NEXT SI
340  RETURN


stripChars: function [str, chars]->
    join select split str => [not? in? & split chars]

print stripChars "She was a soul stripper. She took my heart!" "aei"


string text = "She was a soul stripper. She took my heart!";
string[][] remove = {{"a",""},{"e",""},{"i",""}};

for(var i : remove)
    text = replace(text, remove);
}
write(text);


MsgBox % stripchars("She was a soul stripper. She took my heart!","aei")

StripChars(string, charsToStrip){
   Loop Parse, charsToStrip
      StringReplace, string, string, % A_LoopField, , All
   return string
}


#!/usr/bin/awk -f
BEGIN {
   x = "She was a soul stripper. She took my heart!";
   print x;
   gsub(/[aei]/,"",x);
   print x;
}


text$ = "She was a soul stripper. She took my heart!"
PRINT text$
PRINT EXTRACT$(text$, "[aei]", TRUE)


DECLARE FUNCTION stripchars$(src AS STRING, remove AS STRING)

PRINT stripchars$("She was a soul stripper. She took my heart!", "aei")

FUNCTION stripchars$(src AS STRING, remove AS STRING)
    DIM l0 AS LONG, t AS LONG, s AS STRING
    s = src
    FOR l0 = 1 TO LEN(remove)
        DO
            t = INSTR(s, MID$(remove, l0, 1))
            IF t THEN
                s = LEFT$(s, t - 1) + MID$(s, t + 1)
            ELSE
                EXIT DO
            END IF
        LOOP
    NEXT
    stripchars$ = s
END FUNCTION


function stripchars(texto, remove)
    s = texto
    for i = 1 to length(remove)
        s = replace(s, mid(remove, i, 1), "", true) #true se puede omitir
    next i

    return s
end function

print stripchars("She was a soul stripper. She took my heart!", "aei")


      PRINT FNstripchars("She was a soul stripper. She took my heart!", "aei")
      END

      DEF FNstripchars(A$, S$)
      LOCAL I%, C%, C$
      FOR I% = 1 TO LEN(S$)
        C$ = MID$(S$, I%, 1)
        REPEAT
          C% = INSTR(A$, C$)
          IF C% A$ = LEFT$(A$, C%-1) + MID$(A$, C%+1)
        UNTIL C% = 0
      NEXT
      = A$


get "libhdr"

let contains(str, chr) = valof
$(  for i = 1 to str%0
        if str%i = chr resultis true
    resultis false
$)

let stripchars(str, chars, buf) = valof
$(  buf%0 := 0
    for i = 1 to str%0
        if ~contains(chars, str%i)
        $(  buf%0 := buf%0 + 1
            buf%(buf%0) := str%i
        $)
    resultis buf
$)

let start() be
$(  let buf = vec 127
    writef("%S*N",
        stripchars("She was a soul stripper. She took my heart!",
                   "aei",
                   buf))
$)


  StripChars ← (¬∘∊/⊣)
¬∘∊/⊣
  "She was a soul stripper. She took my heart!" StripChars "aei"
"Sh ws  soul strppr. Sh took my hrt!"


( ( strip
  =   string chars s pat
    .     !arg:(?string.?chars)
        & :?s
        &
            ' ( ?
                ( %
                : [%( utf$!sjt
                    & ( @($chars:? !sjt ?)
                      | rev$!sjt !s:?s
                      )
                    & ~
                    )
                )
                ?
              )
          : (=?pat)
        & @(!string:!pat)
      | rev$(str$!s)
  )
&   out
  $ (strip$("Аппетит приходит во время еды".веп)
);


blsq ) "She was a soul stripper. She took my heart!"{"aei"\/~[n!}f[
"Sh ws  soul strppr. Sh took my hrt!"


#include <string.h>
#include <stdio.h>
#include <stdlib.h>

  /* removes all chars from string */
char *strip_chars(const char *string, const char *chars)
{
  char * newstr = malloc(strlen(string) + 1);
  int counter = 0;

  for ( ; *string; string++) {
    if (!strchr(chars, *string)) {
      newstr[ counter ] = *string;
      ++ counter;
    }
  }

  newstr[counter] = 0;
  return newstr;
}

int main(void)
{
  char *new = strip_chars("She was a soul stripper. She took my heart!", "aei");
  printf("%s\n", new);

  free(new);
  return 0;
}


using System;

public static string RemoveCharactersFromString(string testString, string removeChars)
{
    char[] charAry = removeChars.ToCharArray();
    string returnString = testString;
    foreach (char c in charAry)
    {
        while (returnString.IndexOf(c) > -1)
        {
            returnString = returnString.Remove(returnString.IndexOf(c), 1);
        }
    }
    return returnString;
}


#include <algorithm>
#include <iostream>
#include <string>

std::string stripchars(std::string str, const std::string &chars)
{
    str.erase(
        std::remove_if(str.begin(), str.end(), [&](char c){
            return chars.find(c) != std::string::npos;
        }),
        str.end()
    );
    return str;
}

int main()
{
    std::cout << stripchars("She was a soul stripper. She took my heart!", "aei") << '\n';
    return 0;
}


(defn strip [coll chars]
  (apply str (remove #((set chars) %) coll)))

(strip "She was a soul stripper. She took my heart!" "aei")
;; => "Sh ws  soul strppr. Sh took my hrt!"


stripchars = proc (input, chars: string) returns (string)
    result: array[char] := array[char]$[]
    for c: char in string$chars(input) do
        if string$indexc(c, chars) = 0 then
            array[char]$addh(result, c)
        end
    end
    return(string$ac2s(result))
end stripchars

start_up = proc ()
    po: stream := stream$primary_output()
    stream$putl(po,
        stripchars("She was a soul stripper. She took my heart!", "aei"))
end start_up


       IDENTIFICATION DIVISION.
       PROGRAM-ID. Strip-Chars.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Str-Size  CONSTANT 128.

       LOCAL-STORAGE SECTION.
       01  I       PIC 999.
       01  Str-Pos PIC 999.

       01  Offset  PIC 999.
       01  New-Pos PIC 999.

       01  Str-End PIC 999.

       LINKAGE SECTION.
       01  Str     PIC X(Str-Size).
       01  Chars-To-Replace PIC X(256).

       PROCEDURE DIVISION USING Str BY VALUE Chars-To-Replace.
       Main.
           PERFORM VARYING I FROM 1 BY 1
                   UNTIL Chars-To-Replace (I:1) = X"00"

               MOVE ZERO TO Offset

*              *> Overwrite the characters to remove by left-shifting
*              *> following characters over them.
               PERFORM VARYING Str-Pos FROM 1 BY 1
                       UNTIL Str-Size < Str-Pos
                   IF Str (Str-Pos:1) = Chars-To-Replace (I:1)
                       ADD 1 TO Offset
                   ELSE IF Offset NOT = ZERO
                       COMPUTE New-Pos = Str-Pos - Offset
                       MOVE Str (Str-Pos:1) TO Str (New-Pos:1)
                   END-IF
               END-PERFORM

*              *> Move spaces to characters at the end that have been
*              *> shifted over.
               COMPUTE Str-End = Str-Size - Offset
               MOVE SPACES TO Str (Str-End:Offset)
           END-PERFORM

           GOBACK
           .


<Cfset theString = 'She was a soul stripper. She took my heart!'>
<Cfset theStrip = 'aei'>
<Cfloop from="1" to="#len(theStrip)#" index="i">
  <cfset theString = replace(theString, Mid(theStrip, i, 1), '', 'all')>
</Cfloop>
<Cfoutput>#theString#</Cfoutput>


(defun strip-chars (str chars)
  (remove-if (lambda (ch) (find ch chars)) str))

(strip-chars "She was a soul stripper. She took my heart!" "aei")
;; => "Sh ws  soul strppr. Sh took my hrt!"

;; strip whitespace:
(string-trim
      '(#\Space #\Newline #\Backspace #\Tab
        #\Linefeed #\Page #\Return #\Rubout)
      "  A string   ")
;; => "A string"


import std.stdio, std.string;

void main() {
    auto s = "She was a soul stripper. She took my heart!";
    auto ss = "Sh ws  soul strppr. Sh took my hrt!";
    assert(s.removechars("aei") == ss);
}


program StripCharacters;

{$APPTYPE CONSOLE}

uses SysUtils;

function StripChars(const aSrc, aCharsToStrip: string): string;
var
  c: Char;
begin
  Result := aSrc;
  for c in aCharsToStrip do
    Result := StringReplace(Result, c, '', [rfReplaceAll, rfIgnoreCase]);
end;

const
  TEST_STRING = 'She was a soul stripper. She took my heart!';
begin
  Writeln(TEST_STRING);
  Writeln(StripChars(TEST_STRING, 'aei'));
end.


\util.g

proc nonrec stripchars(*char str, chars, outbuf) *char:
    channel input text ch_in;
    channel output text ch_out;
    [2]char cur = ('\e', '\e');

    open(ch_in, str);
    open(ch_out, outbuf);
    while read(ch_in; cur[0]) do
        if CharsIndex(chars, &cur[0]) = -1 then
            write(ch_out; cur[0])
        fi
    od;
    close(ch_in);
    close(ch_out);
    outbuf
corp

proc nonrec main() void:
    [128]char buf;
    writeln(
        stripchars("She was a soul stripper. She took my heart!",
        "aei", &buf[0]))
corp


;; using regexp /[chars]/g

(define (strip-chars string chars)
  (string-replace string (string-append "/[" chars "]/g") ""))

(strip-chars "She was a soul stripper. She took my heart!" "aei")
    → "Sh ws soul strppr. Sh took my hrt!"


import extensions;
import extensions'text;
import system'routines;

public program()
{
    var testString := "She was a soul stripper. She took my heart!";
    var removeChars := "aei";

    console.printLine(testString.filterBy:(ch => removeChars.indexOf(0, ch) == -1).summarize(new StringWriter()))
}


str = "She was a soul stripper. She took my heart!"
String.replace(str, ~r/[aei]/, "")
# => Sh ws  soul strppr. Sh took my hrt!


4> F = fun(To_stripp, Strip_with) -> lists:filter( fun(C) -> not lists:member(C, Strip_with) end, To_stripp ) end.
#Fun<erl_eval.12.111823515>
5> F("She was a soul stripper. She took my heart!", "aei").
"Sh ws  soul strppr. Sh took my hrt!"


include std\sequence.e
include std\console.e

sequence originalString = "She was a soul stripper. She took my heart!"
puts(1,"Before : " & originalString & "\n")
originalString = transmute(originalString, {{} , "a", "e", "i"}, {{} , "", "", ""})
puts(1,"After : " & originalString & "\n")
any_key()


exceptChars
=LAMBDA(excluded,
    LAMBDA(src,
        CONCAT(
            FILTERP(
                LAMBDA(c,
                    ISERROR(
                        FIND(c, excluded, 1)
                    )
                )
            )(
                CHARSROW(src)
            )
        )
    )
)


let stripChars text (chars:string) =
    Array.fold (
        fun (s:string) c -> s.Replace(c.ToString(),"")
    ) text (chars.ToCharArray())

[<EntryPoint>]
let main args =
    printfn "%s" (stripChars "She was a soul stripper. She took my heart!" "aei")
    0


: append-char ( char str -- ) dup >r  count dup 1+ r> c! + c! ;  \ append char to a counted string
: strippers   ( -- addr len)  s" aeiAEI" ;     \ a string literal returns addr and length

: stripchars ( addr1 len1  addr2 len2 -- PAD len )
        0 PAD c!                               \ clear the PAD buffer
        bounds                                 \ calc loop limits for addr2
        DO
           2dup I [email protected] ( -- addr1 len1 addr1 len1 char)
           scan nip 0=                         \ scan for char in addr1, test for zero
           IF                                  \ if stack = true (ie. NOT found)
              I [email protected] PAD append-char             \ fetch addr2 char, append to PAD
           THEN                                \ ...then ... continue the loop
        LOOP
        2drop                                  \ we don't need STRIPPERS now
        PAD count ;                            \ return PAD address and length


elemental subroutine strip(string,set)
  character(len=*), intent(inout) :: string
  character(len=*), intent(in)    :: set
  integer                         :: old, new, stride
  old = 1; new = 1
  do
    stride = scan( string( old : ), set )
    if ( stride > 0 ) then
      string( new : new+stride-2 ) = string( old : old+stride-2 )
      old = old+stride
      new = new+stride-1
    else
      string( new : ) = string( old : )
      return
    end if
  end do
end subroutine strip


' FB 1.05.0 Win64

Function stripChars(s As Const String, chars As Const String) As String
  If s = "" Then Return ""
  Dim count As Integer = 0
  Dim strip(0 To Len(s) - 1) As Boolean
  For i As Integer = 0 To Len(s) - 1
    For j As Integer = 0 To Len(chars) - 1
      If s[i] = chars[j] Then
        count += 1
        strip(i) = True
        Exit For
      End If
    Next j
  Next i

  Dim buffer As String = Space(Len(s) - count)
  count  = 0
  For i As Integer = 0 To Len(s) - 1
    If Not Strip(i) Then
      buffer[count] = s[i]
      count += 1
    End If
  Next
  Return buffer
End Function

Dim s As String = "She was a soul stripper. She took my heart!"
Dim chars As String = "aei"
Print stripChars(s, chars)
Print
Print "Press any key to quit"
Sleep


stripchars[str, remove] :=
{
   set = toSet[chars[remove]]
   return char[remove[char[str], {|c, set| set.contains[c]}, set]]
}

println[stripchars["She was a soul stripper. She took my heart!","aei"]]


Public Sub Main()

Print StripChars("She was a soul stripper. She took my heart!", "aei")

End
'_____________________________________________________________________
Public Sub StripChars(sText As String, sRemove As String) As String
Dim siCount As Short

For siCount = 1 To Len(sRemove)
  sText = Replace(sText, Mid(sRemove, siCount, 1), "")
Next

Return sText

End


package main

import (
    "fmt"
    "strings"
)

func stripchars(str, chr string) string {
    return strings.Map(func(r rune) rune {
        if strings.IndexRune(chr, r) < 0 {
            return r
        }
        return -1
    }, str)
}

func main() {
    fmt.Println(stripchars("She was a soul stripper. She took my heart!",
        "aei"))
}


def stripChars = { string, stripChars ->
    def list = string as List
    list.removeAll(stripChars as List)
    list.join()
}


stripChars :: String -> String -> String
stripChars = filter . flip notElem


procedure main(A)
    cs := \A[1] | 'aei'   # argument is set of characters to strip
    every write(stripChars(!&input, cs))  # strip all input lines
end

procedure stripChars(s,cs)
    ns := ""
    s ? while ns ||:= (not pos(0), tab(upto(cs)|0)) do tab(many(cs))
    return ns
end


   'She was a soul stripper. She took my heart!' -. 'aei'
Sh ws  soul strppr. Sh took my hrt!


class StripChars {
    public static String stripChars(String inString, String toStrip) {
        return inString.replaceAll("[" + toStrip + "]", "");
    }

    public static void main(String[] args) {
        String sentence = "She was a soul stripper. She took my heart!";
        String chars = "aei";
        System.out.println("sentence: " + sentence);
        System.out.println("to strip: " + chars);
        System.out.println("stripped: " + stripChars(sentence, chars));
    }
}


function stripchars(string, chars) {
  return string.replace(RegExp('['+chars+']','g'), '');
}


def stripchars(string; banish):
  (string | explode) - (banish | explode) | implode;


stripChar = (s, r) -> replace(s, Regex("[$r]") => "")


// version 1.0.6

fun stripChars(s: String, r: String) = s.replace(Regex("[$r]"), "")

fun main(args: Array<String>) {
    println(stripChars("She was a soul stripper. She took my heart!", "aei"))
}


{S.replace (a|e|i)
        by           // nothing
        in She was a soul stripper. She took my heart!}
-> Sh ws  soul strppr. Sh took my hrt!


define stripper(in::string,destroy::string) => {
	with toremove in #destroy->values do => {
		#in->replace(#toremove,'')
	}
	return #in
}
stripper('She was a soul stripper. She took my heart!','aei')


Print stripchars$("She was a soul stripper. She took my heart!", "aei", 1)
End

Function stripchars$(strip$, chars$, num)
    For i = 1 To Len(strip$)
        If Mid$(strip$, i, 1) <> Mid$(chars$, num, 1) Then
            stripchars$ = (stripchars$ + Mid$(strip$, i, 1))
        End If
    Next i
    If (num <= Len(chars$)) Then stripchars$ = stripchars$(stripchars$, chars$, (num + 1))
End Function


function stripChars str charlist
    local strstripped
    put str into strstripped
    repeat for each char c in charlist
        replace c with empty in strstripped
    end repeat
    return strstripped
end stripChars


to strip :string :chars
  output filter [not substringp ? :chars] :string
end

print strip "She\ was\ a\ soul\ stripper.\ She\ took\ my\ heart! "aei

bye


function stripchars(str, chrs)
  local s = str:gsub("["..chrs:gsub("%W","%%%1").."]", '')
  return s
end

print( stripchars( "She was a soul stripper. She took my heart!", "aei" ) )
--> Sh ws  soul strppr. Sh took my hrt!
print( stripchars( "She was a soul stripper. She took my heart!", "a-z" ) )
--> She ws  soul stripper. She took my hert!


with(StringTools):

Remove(c->Has("aei",c), "She was a soul stripper. She took my heart!");


stripchars[a_,b_]:=StringReplace[a,(#->"")&/@Characters[b]]
stripchars["She was a soul stripper. She took my heart!","aei"]
->Sh ws  soul strppr. Sh took my hrt!


function str = stripchars(str, charlist)
  % MATLAB after 2016b: str = erase(str, charlist);
  str(ismember(str, charlist)) = '';


def stripchars(string, chars)
	for char in chars
		string = string.replace(char, "")
	end
	return string
end


StripChars( text : string, remove : string ) : string
{
    def chuck = Explode(remove);
    Concat( "", Split(text, chuck))
}


/* NetRexx */

options replace format comments java crossref savelog symbols

say stripchars("She was a soul stripper. She took my heart!", "aei")

return

method stripchars(haystack, chs) public static

  loop c_ = 1 to chs.length
    needle = chs.substr(c_, 1)
    haystack = haystack.changestr(needle, '')
    end c_

  return haystack


(let (sentence "She was a soul stripper. She took my heart!")
  (replace "[aei]" sentence "" 0))


import strutils

echo "She was a soul stripper. She took my heart!".split({'a','e','i'}).join()

echo "She was a soul stripper. She took my heart!".multiReplace(
  ("a", ""),
  ("e", ""),
  ("i", "")
)

# And another way using module "sequtils".
import sequtils
echo "She was a soul stripper. She took my heart!".filterIt(it notin "aei").join()


@interface NSString (StripCharacters)
- (NSString *) stripCharactersInSet: (NSCharacterSet *) chars;
@end

@implementation NSString (StripCharacters)
- (NSString *) stripCharactersInSet: (NSCharacterSet *) chars {
    return [[self componentsSeparatedByCharactersInSet:chars] componentsJoinedByString:@""];
}
@end


let stripchars s cs =
  let len = String.length s in
  let res = Bytes.create len in
  let rec aux i j =
    if i >= len
    then Bytes.to_string (Bytes.sub res 0 j)
    else if String.contains cs s.[i] then
      aux (succ i) (j)
    else begin
      Bytes.set res j s.[i];
      aux (succ i) (succ j)
    end
  in
  aux 0 0


String method: stripChars(str)  #[ str include not ] self filter ;

"She was a soul stripper. She took my heart!" stripChars("aei") println


stripchars(s, bad)={
  bad=Set(Vec(Vecsmall(bad)));
  s=Vecsmall(s);
  my(v=[]);
  for(i=1,#s,if(!setsearch(bad,s[i]),v=concat(v,s[i])));
  Strchr(v)
};
stripchars("She was a soul stripper. She took my heart!","aei")


sub stripchars {
    my ($s, $chars) = @_;
    $s =~ s/[$chars]//g;
    return $s;
}

print stripchars("She was a soul stripper. She took my heart!", "aei"), "\n";


?filter("She was a soul stripper. She took my heart!","out","aei")


<?php
function stripchars($s, $chars) {
    return str_replace(str_split($chars), "", $s);
}

echo stripchars("She was a soul stripper. She took my heart!", "aei"), "\n";
?>


stripchars(String, Chars) = [C : C in String, not(membchk(C,Chars))].


(de strDiff (Str1 Str2)
   (pack (diff (chop Str1) (chop Str2))) )


strip_chars: procedure (text, chars) returns (character (100) varying);
   declare text character (*) varying, chars character (*) varying;
   declare out_text character (100);
   declare ch character (1);
   declare (i, j) fixed binary;

   j = 0;
   do i = 1 to length(text);
      ch = substr(text, i, 1);
      if index(chars, ch) = 0 then
         do; j = j + 1; substr(out_text, j, 1) = ch; end;
   end;
   return (substr(out_text, 1, j) );
end strip_chars;


100H:
BDOS: PROCEDURE(F,A); DECLARE F BYTE, A ADDRESS; GO TO 5; END BDOS;
EXIT: PROCEDURE; GO TO 0; END EXIT;
PRINT: PROCEDURE(S); DECLARE S ADDRESS; CALL BDOS(9,S); END PRINT;
DECLARE TRUE LITERALLY '0FFH', FALSE LITERALLY '0';

/* SEE IF STRING CONTAINS CHARACTER */
CONTAINS: PROCEDURE(STR, CHR) BYTE;
    DECLARE STR ADDRESS, (SCH BASED STR, CHR) BYTE;
    DO WHILE SCH <> '$';
        IF SCH = CHR THEN RETURN TRUE;
        STR = STR + 1;
    END;
    RETURN FALSE;
END CONTAINS;

/* STRIP CHARACTERS FROM A STRING */
STRIP$CHARS: PROCEDURE(STR, CHARS, OUTBUF);
    DECLARE (STR, CHARS, OUTBUF) ADDRESS;
    DECLARE (IN$CH BASED STR, OUT$CH BASED OUTBUF) BYTE;
    DO WHILE IN$CH <> '$';
        IF NOT CONTAINS(CHARS, IN$CH) THEN DO;
            OUT$CH = IN$CH;
            OUTBUF = OUTBUF + 1;
        END;
        STR = STR + 1;
    END;
    OUT$CH = '$';
END STRIP$CHARS;

/* TEST */
DECLARE BUF (128) ADDRESS;

/* 8080 PL/M DOES NOT SUPPORT LOWERCASE OR EXCLAMATION MARK */
CALL STRIP$CHARS(
    .'SHE WAS A SOUL STRIPPER. SHE TOOK MY HEART.$',
    .'AEI$',
    .BUF);
CALL PRINT(.BUF);
CALL EXIT;
EOF


'She was a soul stripper. She took my heart!' -replace '[aei]', ''
Sh ws  soul strppr. Sh took my hrt!


:- use_module(library(lambda)).

stripchars(String, Exclude, Result) :-
	exclude(\X^(member(X, Exclude)), String, Result1),
	string_to_list(Result, Result1).


Procedure.s stripChars(source.s,  charsToStrip.s)
  Protected i, *ptrChar.Character, length = Len(source), result.s
  *ptrChar = @source
  For i = 1 To length
    If Not FindString(charsToStrip, Chr(*ptrChar\c))
      result + Chr(*ptrChar\c)
    EndIf
    *ptrChar + SizeOf(Character)
  Next
  ProcedureReturn result
EndProcedure

If OpenConsole()
  PrintN(stripChars("She was a soul stripper. She took my heart!", "aei"))

  Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input()
  CloseConsole()
EndIf


>>> def stripchars(s, chars):
...     return s.translate(None, chars)
...
>>> stripchars("She was a soul stripper. She took my heart!", "aei")
'Sh ws  soul strppr. Sh took my hrt!'


  [ $ "" swap witheach [ upper join ] ] is upper$ (   $ --> $ )

  [ $ "" swap witheach [ lower join ] ] is lower$ (   $ --> $ )

  [ 0 swap witheach [ bit | ] ]         is ->set  (   [ --> s )

  [ bit & not ]                         is !in    ( s c --> b )

  [ $ "" unrot
    upper$ dup lower$ join ( omit this line for case-sensitive )
    ->set swap witheach
      [ 2dup !in iff
          [ swap dip join ]
        else drop ] drop ]              is strip$ ( $ $ --> $ )

  $ "One is never alone with a rubber duck." dup echo$ cr
  $ "EIU" strip$ echo$ cr


#lang racket

;; Using list operations
(define (stripchars1 text chars)
  (list->string (remove* (string->list chars) (string->list text))))

;; Using a regexp
;; => will be broken if chars have "-" or "]" or "\\"
(define (stripchars2 text chars)
  (regexp-replace* (~a "[" chars "]+") text ""))


sub strip_chars ( $s, $chars ) {
    return $s.trans( $chars.comb X=> '' );
}

say strip_chars( 'She was a soul stripper. She took my heart!', 'aei' );


stripchars: func [str chars] [trim/with str chars]
stripchars "She was a soul stripper. She took my heart!" "aei"


/*REXX program  removes  a list of characters from a string  (the haystack).            */
say stripChars('She was a soul stripper. She took my heart!',   "iea")     /*elide: iea */
exit                                             /*stick a fork in it,  we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
stripChars: procedure;  parse arg haystack, remove
                                do j=1  for length(remove)
                                haystack=changestr( substr( remove, j, 1),  haystack, '')
                                end   /*j*/
            return haystack


aList = "She was a soul stripper. She took my heart!"
bList = "aei"
see aList + nl
see stripChars(aList,bList)

func stripChars cList, dList
     for n = 1 to len(dList)
         cList = substr(cList,dList[n],"") + nl
     next
     return cList


"She was a soul stripper. She took my heart!".delete("aei")  # => "Sh ws  soul strppr. Sh took my hrt!"


function stripchars(texto, remove)
    s = texto
    for i = 1 to length(remove)
        s = replace(s, mid(remove, i, 1), "", true)
    next i

    return s
end function


fn strip_characters(original : &str, to_strip : &str) -> String {
    let mut result = String::new();
    for c in original.chars() {
        if !to_strip.contains(c) {
           result.push(c);
       }
    }
    result
}


%let string=She was a soul stripper. She took my heart!;
%let chars=aei;
%let stripped=%sysfunc(compress("&string","&chars"));
%put &stripped;


def stripChars(s:String, ch:String)= s filterNot (ch contains _)

stripChars("She was a soul stripper. She took my heart!", "aei")
// => Sh ws  soul strppr. Sh took my hrt!


(import (scheme base)
        (scheme write)
        (only (srfi 13) string-delete)
        (only (srfi 14) ->char-set))

;; implementation in plain Scheme
(define (strip-chars str chars)
  (let ((char-list (string->list chars)))
    (define (do-strip str-list result)
      (cond ((null? str-list)
             (reverse result))
            ((member (car str-list) char-list char=?)
             (do-strip (cdr str-list) result))
            (else
              (do-strip (cdr str-list) (cons (car str-list) result)))))
    (list->string
      (do-strip (string->list str) '()))))

(display (strip-chars "She was a soul stripper. She took my heart!" "aei"))
(newline)

;; using functions in SRFI 13 and SRFI 14
(define (strip-chars2 str chars)
  (string-delete (->char-set chars) str))

(display (strip-chars2 "She was a soul stripper. She took my heart!" "aei"))
(newline)


str1 = "She was a soul stripper. She took my heart!"
rmv = "aei"
FOR i = 1 TO LEN(rmv)
  str1 = REPLACE(str1, MID(rmv, i, 1), "")
NEXT
PRINT str1,"\n"


#!/bin/bash

strip_char()
{
  echo "$1" | sed "s/[$2]//g"
}


$ include "seed7_05.s7i";

const func string: stripchars (in string: mainStri, in string: charList) is func
  result
    var string: strippedStri is "";
  local
    var char: ch is ' ';
  begin
    strippedStri := mainStri;
    for ch range charList do
      strippedStri := replace(strippedStri, str(ch), "");
    end for;
  end func;

const proc: main is func
  begin
    writeln(stripchars("She was a soul stripper. She took my heart!", "aei"));
  end func;


func stripchars(str, char_list) {
    str.tr(char_list, "", "d");
}


| stripChars |
stripChars := [ :string :chars |
	string reject: [ :c | chars includes: c ] ].
stripChars
	value: 'She was a soul stripper. She took my heart!'
	value: 'aei'.

"'Sh ws  soul strppr. Sh took my hrt!'"


      DEFINE("strip(strip,c)")         :(strip_end)
strip strip ANY(c) =                   :S(strip)F(RETURN)
strip_end

      chars = HOST(2, HOST(3))   ;* Get command line argument
      chars = IDENT(chars) "aei"
again line = INPUT                    :F(END)
      OUTPUT = strip(line, chars)     :(again)
END


fun stripchars (string, chars) = let
  fun aux c =
    if String.isSubstring (str c) chars then
      ""
    else
      str c
in
  String.translate aux string
end


extension String {
  func stripCharactersInSet(chars: [Character]) -> String {
    return String(seq: filter(self) {find(chars, $0) == nil})
  }
}

let aString = "She was a soul stripper. She took my heart!"
let chars: [Character] = ["a", "e", "i"]

println(aString.stripCharactersInSet(chars))


proc stripchars {str chars} {
    foreach c [split $chars ""] {set str [string map [list $c ""] $str]}
    return $str
}

set s "She was a soul stripper. She took my heart!"
puts [stripchars $s "aei"]


 $string = "She was a soul stripper. She took my heart!";
 $chars = "aei";
 $newString = stripChars($string, $chars);
 echo($string);
 echo($newString);


#lang transd

MainModule: {
    _start: (λ
        (with s "She was a soul stripper. She took my heart!"
            (textout (replace s "(a|e|i)" "")))
    )
}


FUNCTION stripchars$(text$, remove$)
    LET s$ = text$
    FOR i = 1 TO LEN(remove$)
        DO
           LET t = POS(s$, (remove$)[i:i])
           IF t <> 0 THEN LET s$ = (s$)[1:t-1] & (s$)[t+1:maxnum] ELSE EXIT DO
        LOOP
    NEXT i
    LET stripchars$ = s$
END FUNCTION

PRINT stripchars$("She was a soul stripper. She took my heart!", "aei")
END


$$ MODE TUSCRIPT,{}
string="She was a soul stripper. She took my heart!"
stringstrip=EXCHANGE (string,"_[aei]__")
print string
print stringstrip


(defun strip-chars (str set)
  (let* ((regex-ast ^(set ,*(list-str set)))
         (regex-obj (regex-compile regex-ast)))
    (regsub regex-obj "" str)))

(defun usage ()
  (pprinl `usage: @{(ldiff *full-args* *args*) " "} <string> <set>`)
  (exit 1))

(tree-case *args*
  ((str set extra) (usage))
  ((str set . junk) (pprinl (strip-chars str set)))
  (else (usage)))


strip_chars() {
  echo "$1" | tr -d "$2"
}


strip = ~&j

#cast %s

test = strip('she was a soul stripper. she took my heart','aei')


Function StripChars(stString As String, stStripChars As String, Optional bSpace As Boolean)
Dim i As Integer, stReplace As String
    If bSpace = True Then
        stReplace = " "
    Else
        stReplace = ""
    End If
    For i = 1 To Len(stStripChars)
        stString = Replace(stString, Mid(stStripChars, i, 1), stReplace)
    Next i
    StripChars = stString
End Function


Function stripchars(s1,s2)
	For i = 1 To Len(s1)
		If InStr(s2,Mid(s1,i,1)) Then
			s1 = Replace(s1,Mid(s1,i,1),"")
		End If
	Next
	stripchars = s1
End Function

WScript.StdOut.Write stripchars("She was a soul stripper. She took my heart!","aei")


var stripChars = Fn.new { |s, t|
    return s.map { |c|
        return (t.indexOf(c) == -1) ? c : ""
    }.join()
}

System.print(stripChars.call("She was a soul stripper. She took my heart!", "aei"))


string 0;                       \make strings zero-terminated

func In(Char, Chars);           \Is Char in the string Chars?
char Char, Chars;
int  I;
for I:= 0 to -1>>1 do           \for many times...
        [if Chars(I) = 0 then return false;
         if Chars(I) = Char then return true;
        ];

func StripChars(String, Chars); \Remove Chars from String
char String, Chars;
int  I, O;
[O:= 0;
for I:= 0 to -1>>1 do           \for many times...
    [if not In(String(I), Chars) then
        [String(O):= String(I);  O:= O+1];
    if String(I)=0 then return String;
    ];
];

Text(0, StripChars("She was a soul stripper. She took my heart!", "aei"))


sub stripchars$(text$, remove$)
    local i, t, s$
    s$ = text$
    for i = 1 to len(remove$)
        do
            t = instr(s$, mid$(remove$, i, 1))
            if t then s$ = left$(s$, t - 1) + mid$(s$, t + 1) else break : fi
        loop
    next i
    return s$
end sub

print stripchars$("She was a soul stripper. She took my heart!", "aei")


println("She was a soul stripper. She took my heart!" - "aei")
//-->Sh ws  soul strppr. Sh took my hrt!


V extra = ‘little’
print(‘Mary had a ’extra‘ lamb.’)
print(‘Mary had a #. lamb.’.format(extra))
print(f:‘Mary had a {extra} lamb.’)


/* ARM assembly AARCH64 Raspberry PI 3B */
/*  program insertString64.s   */
/* In assembler, there is no function to insert a chain */
/* so this program offers two functions to insert    */
/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"

.equ CHARPOS,       '@'

/*******************************************/
/* Initialized data                        */
/*******************************************/
.data
szString:           .asciz " string "
szString1:          .asciz "insert"
szString2:          .asciz "[email protected]"
szString3:          .asciz "abcdef @"
szString4:          .asciz "@ abcdef"
szCarriageReturn:   .asciz "\n"
/*******************************************/
/* UnInitialized data                      */
/*******************************************/
.bss
/*******************************************/
/*  code section                           */
/*******************************************/
.text
.global main
main:                            // entry of program

    ldr x0,qAdrszString          // string address
    ldr x1,qAdrszString1         // string address
    mov x2,#0
    bl strInsert                 //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr x0,qAdrszCarriageReturn
    bl affichageMess

    ldr x0,qAdrszString          // string address
    ldr x1,qAdrszString1         // string address
    mov x2,#3
    bl strInsert                 //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr x0,qAdrszCarriageReturn
    bl affichageMess

    ldr x0,qAdrszString          // string address
    ldr x1,qAdrszString1         // string address
    mov x2,#40
    bl strInsert                 //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr x0,qAdrszCarriageReturn
    bl affichageMess

    ldr x0,qAdrszString2         // string address
    ldr x1,qAdrszString1         // string address
    bl strInsertAtChar           //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr x0,qAdrszCarriageReturn
    bl affichageMess

    ldr x0,qAdrszString3         // string address
    ldr x1,qAdrszString1         // string address
    bl strInsertAtChar           //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr x0,qAdrszCarriageReturn
    bl affichageMess

    ldr x0,qAdrszString4         // string address
    ldr x1,qAdrszString1         // string address
    bl strInsertAtChar           //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr x0,qAdrszCarriageReturn
    bl affichageMess
100:                             // standard end of the program
    mov x0, #0                   // return code
    mov x8, #EXIT                // request to exit program
    svc 0                        // perform the system call
qAdrszString:          .quad szString
qAdrszString1:         .quad szString1
qAdrszString2:         .quad szString2
qAdrszString3:         .quad szString3
qAdrszString4:         .quad szString4
qAdrszCarriageReturn:  .quad szCarriageReturn
/******************************************************************/
/*   insertion of a sub-chain in a chain in the desired position  */
/******************************************************************/
/* x0 contains the address of string 1 */
/* x1 contains the address of string to insert */
/* x2 contains the position of insertion :
      0 start string
      if x2 > lenght string 1 insert at end of string*/
/* x0 return the address of new string  on the heap */
strInsert:
    stp x1,lr,[sp,-16]!                      // save  registers
    stp x2,x3,[sp,-16]!                      // save  registers
    mov x3,#0                                // length counter
1:                                           // compute length of string 1
    ldrb w4,[x0,x3]
    cmp w4,#0
    cinc  x3,x3,ne                           // increment to one if not equal
    bne 1b                                   // loop if not equal
    mov x5,#0                                // length counter insertion string
2:                                           // compute length of insertion string
    ldrb w4,[x1,x5]
    cmp x4,#0
    cinc  x5,x5,ne                           // increment to one if not equal
    bne 2b
    cmp x5,#0
    beq 99f                                  // string empty -> error
    add x3,x3,x5                             // add 2 length
    add x3,x3,#1                             // +1 for final zero
    mov x6,x0                                // save address string 1
    mov x0,#0                                // allocation place heap
    mov x8,BRK                               // call system 'brk'
    svc #0
    mov x5,x0                                // save address heap for output string
    add x0,x0,x3                             // reservation place x3 length
    mov x8,BRK                               // call system 'brk'
    svc #0
    cmp x0,#-1                               // allocation error
    beq 99f
    //
    mov x8,#0                                // index load characters string 1
    cmp x2,#0                                // index insertion = 0
    beq 5f                                   // insertion at string 1 begin
3:                                           // loop copy characters string 1
    ldrb w0,[x6,x8]                          // load character
    cmp w0,#0                                // end string ?
    beq 5f                                   // insertion at end
    strb w0,[x5,x8]                          // store character in output string
    add x8,x8,#1                             // increment index
    cmp x8,x2                                // < insertion index ?
    blt 3b                                   // yes -> loop
5:
    mov x4,x8                                // init index character output string
    mov x3,#0                                // index load characters insertion string
6:
    ldrb w0,[x1,x3]                          // load characters insertion string
    cmp w0,#0                                // end string ?
    beq 7f
    strb w0,[x5,x4]                          // store in output string
    add x3,x3,#1                             // increment index
    add x4,x4,#1                             // increment output index
    b 6b                                     // and loop
7:
    ldrb w0,[x6,x8]                          // load other character string 1
    strb w0,[x5,x4]                          // store in output string
    cmp x0,#0                                // end string 1 ?
    beq 8f                                   // yes -> end
    add x4,x4,#1                             // increment output index
    add x8,x8,#1                             // increment index
    b 7b                                     // and loop
8:
    mov x0,x5                                // return output string address
    b 100f
99:                                          // error
    mov x0,#-1
100:
    ldp x2,x3,[sp],16                        // restaur  2 registers
    ldp x1,lr,[sp],16                        // restaur  2 registers
    ret
/******************************************************************/
/*   insert string at character insertion                         */
/******************************************************************/
/* x0 contains the address of string 1 */
/* x1 contains the address of insertion string   */
/* x0 return the address of new string  on the heap */
/* or -1 if error   */
strInsertAtChar:
    stp x1,lr,[sp,-16]!                      // save  registers
    stp x2,x3,[sp,-16]!                      // save  registers
    mov x3,#0                                // length counter
1:                                           // compute length of string 1
    ldrb w4,[x0,x3]
    cmp w4,#0
    cinc  x3,x3,ne                           // increment to one if not equal
    bne 1b                                   // loop if not equal
    mov x5,#0                                // length counter insertion string
2:                                           // compute length to insertion string
    ldrb w4,[x1,x5]
    cmp x4,#0
    cinc  x5,x5,ne                           // increment to one if not equal
    bne 2b                                   // and loop
    cmp x5,#0
    beq 99f                                  // string empty -> error
    add x3,x3,x5                             // add 2 length
    add x3,x3,#1                             // +1 for final zero
    mov x6,x0                                // save address string 1
    mov x0,#0                                // allocation place heap
    mov x8,BRK                               // call system 'brk'
    svc #0
    mov x5,x0                                // save address heap for output string
    add x0,x0,x3                             // reservation place x3 length
    mov x8,BRK                               // call system 'brk'
    svc #0
    cmp x0,#-1                               // allocation error
    beq 99f

    mov x2,0
    mov x4,0
3:                                           // loop copy string begin
    ldrb w3,[x6,x2]
    cmp w3,0
    beq 99f
    cmp w3,CHARPOS                           // insertion character ?
    beq 5f                                   // yes
    strb w3,[x5,x4]                          // no store character in output string
    add x2,x2,1
    add x4,x4,1
    b 3b                                     // and loop
5:                                           // x4 contains position insertion
    add x8,x4,1                              // init index character output string
                                             // at position insertion + one
    mov x3,#0                                // index load characters insertion string
6:
    ldrb w0,[x1,x3]                          // load characters insertion string
    cmp w0,#0                                // end string ?
    beq 7f                                   // yes
    strb w0,[x5,x4]                          // store in output string
    add x3,x3,#1                             // increment index
    add x4,x4,#1                             // increment output index
    b 6b                                     // and loop
7:                                           // loop copy end string
    ldrb w0,[x6,x8]                          // load other character string 1
    strb w0,[x5,x4]                          // store in output string
    cmp x0,#0                                // end string 1 ?
    beq 8f                                   // yes -> end
    add x4,x4,#1                             // increment output index
    add x8,x8,#1                             // increment index
    b 7b                                     // and loop
8:
    mov x0,x5                                // return output string address
    b 100f
99:                                          // error
    mov x0,#-1
100:
    ldp x2,x3,[sp],16                        // restaur  2 registers
    ldp x1,lr,[sp],16                        // restaur  2 registers
    ret

/********************************************************/
/*        File Include fonctions                        */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"


PROC Main()
  CHAR ARRAY extra="little"

  PrintF("Mary had a %S lamb.%E",extra)
RETURN


with Ada.Strings.Fixed, Ada.Text_IO;
use  Ada.Strings, Ada.Text_IO;
procedure String_Replace is
   Original : constant String := "Mary had a @[email protected] lamb.";
   Tbr : constant String := "@[email protected]";
   New_Str : constant String := "little";
   Index : Natural := Fixed.Index (Original, Tbr);
begin
   Put_Line (Fixed.Replace_Slice (
     Original, Index, Index + Tbr'Length - 1, New_Str));
end String_Replace;


const little = "little"
printf ("Mary had a %s lamb\n", little)

// alternatively
println ("Mary had a " + little + " lamb")


main:(
# as a STRING #
  STRING extra = "little";
  printf(($"Mary had a "g" lamb."l$, extra));

# as a FORMAT #
  FORMAT extraf = $"little"$;
  printf($"Mary had a "f(extraf)" lamb."l$);

# or: use simply use STRING concatenation #
  print(("Mary had a "+extra+" lamb.", new line))
)


/* ARM assembly Raspberry PI  */
/*  program insertString.s   */

/* REMARK 1 : this program use routines in a include file
   see task Include a file language arm assembly
   for the routine affichageMess conversion10
   see at end of this program the instruction include */
/*******************************************/
/* Constantes                              */
/*******************************************/
.equ STDOUT, 1           @ Linux output console
.equ EXIT,   1           @ Linux syscall
.equ WRITE,  4           @ Linux syscall
.equ BRK,    0x2d        @ Linux syscall
.equ CHARPOS,       '@'

/*******************************************/
/* Initialized data                        */
/*******************************************/
.data
szString:           .asciz " string "
szString1:          .asciz "insert"
szString2:          .asciz "[email protected]"
szString3:          .asciz "abcdef @"
szString4:          .asciz "@ abcdef"
szCarriageReturn:   .asciz "\n"
/*******************************************/
/* UnInitialized data                      */
/*******************************************/
.bss
/*******************************************/
/*  code section                           */
/*******************************************/
.text
.global main
main:                            // entry of program

    ldr r0,iAdrszString          // string address
    ldr r1,iAdrszString1         // string address
    mov r2,#0
    bl strInsert                 //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr r0,iAdrszCarriageReturn
    bl affichageMess

    ldr r0,iAdrszString          // string address
    ldr r1,iAdrszString1         // string address
    mov r2,#3
    bl strInsert                 //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr r0,iAdrszCarriageReturn
    bl affichageMess

    ldr r0,iAdrszString          // string address
    ldr r1,iAdrszString1         // string address
    mov r2,#40
    bl strInsert                 //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr r0,iAdrszCarriageReturn
    bl affichageMess

    ldr r0,iAdrszString2         // string address
    ldr r1,iAdrszString1         // string address
    bl strInsertAtChar           //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr r0,iAdrszCarriageReturn
    bl affichageMess

    ldr r0,iAdrszString3         // string address
    ldr r1,iAdrszString1         // string address
    bl strInsertAtChar           //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr r0,iAdrszCarriageReturn
    bl affichageMess

    ldr r0,iAdrszString4         // string address
    ldr r1,iAdrszString1         // string address
    bl strInsertAtChar           //
                                 // return new pointer
    bl affichageMess             // display result string
    ldr r0,iAdrszCarriageReturn
    bl affichageMess
100:                             // standard end of the program
    mov r0, #0                   // return code
    mov r7, #EXIT                // request to exit program
    svc 0                        // perform the system call
iAdrszString:          .int szString
iAdrszString1:         .int szString1
iAdrszString2:         .int szString2
iAdrszString3:         .int szString3
iAdrszString4:         .int szString4
iAdrszCarriageReturn:  .int szCarriageReturn
/******************************************************************/
/*   insertion of a sub-chain in a chain in the desired position  */
/******************************************************************/
/* r0 contains the address of string 1 */
/* r1 contains the address of string to insert */
/* r2 contains the position of insertion :
      0 start string
      if r2 > lenght string 1 insert at end of string*/
/* r0 return the address of new string  on the heap */
strInsert:
    push {r1-r4,lr}                         @ save  registres
    mov r3,#0                                // length counter
1:                                           // compute length of string 1
    ldrb r4,[r0,r3]
    cmp r4,#0
    addne r3,r3,#1                          // increment to one if not equal
    bne 1b                                   // loop if not equal
    mov r5,#0                                // length counter insertion string
2:                                           // compute length of insertion string
    ldrb r4,[r1,r5]
    cmp r4,#0
    addne r5,r5,#1                          // increment to one if not equal
    bne 2b
    cmp r5,#0
    beq 99f                                  // string empty -> error
    add r3,r3,r5                             // add 2 length
    add r3,r3,#1                             // +1 for final zero
    mov r6,r0                                // save address string 1
    mov r0,#0                                // allocation place heap
    mov r7,#BRK                               // call system 'brk'
    svc #0
    mov r5,r0                                // save address heap for output string
    add r0,r0,r3                             // reservation place r3 length
    mov r7,#BRK                               // call system 'brk'
    svc #0
    cmp r0,#-1                               // allocation error
    beq 99f
    //
    mov r7,#0                                // index load characters string 1
    cmp r2,#0                                // index insertion = 0
    beq 5f                                   // insertion at string 1 begin
3:                                           // loop copy characters string 1
    ldrb r0,[r6,r7]                          // load character
    cmp r0,#0                                // end string ?
    beq 5f                                   // insertion at end
    strb r0,[r5,r7]                          // store character in output string
    add r7,r7,#1                             // increment index
    cmp r7,r2                                // < insertion index ?
    blt 3b                                   // yes -> loop
5:
    mov r4,r7                                // init index character output string
    mov r3,#0                                // index load characters insertion string
6:
    ldrb r0,[r1,r3]                          // load characters insertion string
    cmp r0,#0                                // end string ?
    beq 7f
    strb r0,[r5,r4]                          // store in output string
    add r3,r3,#1                             // increment index
    add r4,r4,#1                             // increment output index
    b 6b                                     // and loop
7:
    ldrb r0,[r6,r7]                          // load other character string 1
    strb r0,[r5,r4]                          // store in output string
    cmp r0,#0                                // end string 1 ?
    beq 8f                                   // yes -> end
    add r4,r4,#1                             // increment output index
    add r7,r7,#1                             // increment index
    b 7b                                     // and loop
8:
    mov r0,r5                                // return output string address
    b 100f
99:                                          // error
    mov r0,#-1
100:
    pop {r1-r4,lr}                          @ restaur registers
    bx lr                                   @ return
/******************************************************************/
/*   insert string at character insertion                         */
/******************************************************************/
/* r0 contains the address of string 1 */
/* r1 contains the address of insertion string   */
/* r0 return the address of new string  on the heap */
/* or -1 if error   */
strInsertAtChar:
    push {r1-r7,lr}                         @ save  registres
    mov r3,#0                                // length counter
1:                                           // compute length of string 1
    ldrb r4,[r0,r3]
    cmp r4,#0
    addne r3,r3,#1                           // increment to one if not equal
    bne 1b                                   // loop if not equal
    mov r5,#0                                // length counter insertion string
2:                                           // compute length to insertion string
    ldrb r4,[r1,r5]
    cmp r4,#0
    addne r5,r5,#1                           // increment to one if not equal
    bne 2b                                   // and loop
    cmp r5,#0
    beq 99f                                  // string empty -> error
    add r3,r3,r5                             // add 2 length
    add r3,r3,#1                             // +1 for final zero
    mov r6,r0                                // save address string 1
    mov r0,#0                                // allocation place heap
    mov r7,#BRK                               // call system 'brk'
    svc #0
    mov r5,r0                                // save address heap for output string
    add r0,r0,r3                             // reservation place r3 length
    mov r7,#BRK                               // call system 'brk'
    svc #0
    cmp r0,#-1                               // allocation error
    beq 99f

    mov r2,#0
    mov r4,#0
3:                                           // loop copy string begin
    ldrb r3,[r6,r2]
    cmp r3,#0
    beq 99f
    cmp r3,#CHARPOS                           // insertion character ?
    beq 5f                                   // yes
    strb r3,[r5,r4]                          // no store character in output string
    add r2,r2,#1
    add r4,r4,#1
    b 3b                                     // and loop
5:                                           // r4 contains position insertion
    add r7,r4,#1                              // init index character output string
                                             // at position insertion + one
    mov r3,#0                                // index load characters insertion string
6:
    ldrb r0,[r1,r3]                          // load characters insertion string
    cmp r0,#0                                // end string ?
    beq 7f                                   // yes
    strb r0,[r5,r4]                          // store in output string
    add r3,r3,#1                             // increment index
    add r4,r4,#1                             // increment output index
    b 6b                                     // and loop
7:                                           // loop copy end string
    ldrb r0,[r6,r7]                          // load other character string 1
    strb r0,[r5,r4]                          // store in output string
    cmp r0,#0                                // end string 1 ?
    beq 8f                                   // yes -> end
    add r4,r4,#1                             // increment output index
    add r7,r7,#1                             // increment index
    b 7b                                     // and loop
8:
    mov r0,r5                                // return output string address
    b 100f
99:                                          // error
    mov r0,#-1
100:
    pop {r1-r7,lr}                          @ restaur registers
    bx lr                                   @ return
/***************************************************/
/*      ROUTINES INCLUDE                 */
/***************************************************/
.include "../affichage.inc"


      s ← 'Mary had a ∆ lamb' ⋄ s[s⍳'∆'] ← ⊂'little' ⋄ s ← ∊s
      s
Mary had a little lamb

⍝⍝⍝ Or, for a more general version which interpolates multiple positional arguments and can
⍝⍝⍝ handle both string and numeric types...

∇r ← s sInterp sv
⍝⍝ Interpolate items in sv into s (string field substitution)
⍝ s: string - format string, '∆' used for interpolation points
⍝ sv: vector - vector of items to interpolate into s
⍝ r: interpolated string
  s[('∆'=s)/⍳⍴s] ← ⊃¨(⍕¨sv)
  r ← ∊s
∇
      'Mary had a ∆ lamb, its fleece was ∆ as ∆.' sInterp 'little' 'black' 'night'
Mary had a little lamb, its fleece was black as night.
      'Mary had a ∆ lamb, its fleece was ∆ as ∆.' sInterp 'little' 'large' 42
Mary had a little lamb, its fleece was large as 42.


sizeOfLamb: "little"

print ~"Mary had a |sizeOfLamb| lamb."


string s1 = "big";
write("Mary had a " + s1 + " lamb");
s1 = "little";
write("Mary also had a ", s1, "lamb");


; Using the = operator
LIT = little
string = Mary had a %LIT% lamb.

; Using the := operator
LIT := "little"
string := "Mary had a" LIT " lamb."

MsgBox %string%


V s1 = ‘hello’
print(s1‘ world’)
V s2 = s1‘ world’
print(s2)


#!/usr/bin/awk -f
BEGIN {
	str="Mary had a # lamb."
	gsub(/#/, "little", str)
	print str
}


x$ = "big"
print "Mary had a "; x$; " lamb"

x$ = "little"
print "Mary also had a "; ljust(x$, length(x$)); " lamb"


@echo off
setlocal enabledelayedexpansion
call :interpolate %1 %2 res
echo %res%
goto :eof

:interpolate
set pat=%~1
set str=%~2
set %3=!pat:X=%str%!
goto :eof


Str ← (3⌊•Type)◶⟨2=•Type∘⊑,0,1,0⟩
_interpolate ← {∾(•Fmt⍟(¬Str)¨𝕨)⌾((𝕗=𝕩)⊸/)𝕩}

'a'‿"def"‿45‿⟨1,2,3⟩‿0.34241 '·'_interpolate "Hi · am · and · or · float ·"


@("Mary had a X lamb":?a X ?z) & str$(!a little !z)


/* ARM assembly AARCH64 Raspberry PI 3B */
/*  program concatStr64.s   */

/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
/*******************************************/
/* Initialized data                        */
/*******************************************/
.data
szMessFinal:   .asciz "The final string is \n"

szString:            .asciz "Hello "
szString1:           .asciz " the world. \n"
/*******************************************/
/* UnInitialized data                      */
/*******************************************/
.bss
szFinalString:   .skip 255
/*******************************************/
/*  code section                           */
/*******************************************/
.text
.global main
main:
                                   // load string
    ldr x1,qAdrszString
    ldr x2,qAdrszFinalString
    mov x4,0
1:
    ldrb w0,[x1,x4]                // load byte of string
    strb w0,[x2,x4]
    cmp x0,0                       // compar with zero ?
    add x3,x4,1
    csel x4,x3,x4,ne               // if x0 <> 0 x4 = x4 +1 sinon x4
    bne 1b
    ldr x1,qAdrszString1
    mov x3,0
2:
    ldrb w0,[x1,x3]                // load byte of string 1
    strb w0,[x2,x4]
    cmp x0,0                       // compar with zero ?
    add x5,x4,1
    csel x4,x5,x4,ne
    add x5,x3,1
    csel x3,x5,x3,ne
    bne 2b
    mov x0,x2                      // display final string
    bl affichageMess
100:                               // standard end of the program */
    mov x0,0                       // return code
    mov x8,EXIT                    // request to exit program
    svc 0                          // perform the system call
qAdrszString:             .quad szString
qAdrszString1:            .quad szString1
qAdrszFinalString:        .quad szFinalString
qAdrszMessFinal:          .quad szMessFinal
/********************************************************/
/*        File Include fonctions                        */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"


DATA: s1 TYPE string,
      s2 TYPE string.

s1 = 'Hello'.
CONCATENATE s1 ' literal' INTO s2 RESPECTING BLANKS.
WRITE: / s1.
WRITE: / s2.


PROC Append(CHAR ARRAY text,suffix)
  BYTE POINTER srcPtr,dstPtr
  BYTE len

  len=suffix(0)
  IF text(0)+len>255 THEN
    len=255-text(0)
  FI
  IF len THEN
    srcPtr=suffix+1
    dstPtr=text+text(0)+1
    MoveBlock(dstPtr,srcPtr,len)
    text(0)==+suffix(0)
  FI
RETURN

PROC Concatenate(CHAR ARRAY text,left,right)
  SCopy(text,left)
  Append(text,right)
RETURN

PROC TestConcatenate(CHAR ARRAY left,right)
  CHAR ARRAY text(256)

  Concatenate(text,left,right)
  PrintF("""%S""+""%S""=""%S""%E",left,right,text)
RETURN

PROC Main()
  TestConcatenate("Hello", " World!")
RETURN


package
{
    public class Str
    {
        public static function main():void
        {
            var s:String = "hello";
            trace(s + " literal");
            var s2:String = s + " literal";
            trace(s2);
        }
    }
}


#include <stdio.h>

int main() {
  const char *extra = "little";
  printf("Mary had a %s lamb.\n", extra);
  return 0;
}


class Program
{
    static void Main()
    {
        string extra = "little";
        string formatted = $"Mary had a {extra} lamb.";
        System.Console.WriteLine(formatted);
    }
}


#include <string>
#include <iostream>

int main( ) {
   std::string original( "Mary had a X lamb." ) , toBeReplaced( "X" ) ,
      replacement ( "little" ) ;
   std::string newString = original.replace( original.find( "X" ) ,
	 toBeReplaced.length( ) , replacement ) ;
   std::cout << "String after replacement: " << newString << " \n" ;
   return 0 ;
}


(let [little "little"]
  (println (format "Mary had a %s lamb." little)))


with Ada.Text_IO;  use Ada.Text_IO;

procedure String_Concatenation is
   S1 : constant String := "Hello";
   S2 : constant String := S1 & " literal";
begin
   Put_Line (S1);
   Put_Line (S2);
end String_Concatenation;


STRING s := "hello";
print ((s + " literal", new line));
STRING s1 := s + " literal";
print ((s1, new line))


begin

comment
   The string concatenation operator is ||, and the
   default string length is 10 characters unless a
   longer length (up to 255) is explicitly declared;

string(20) s1, s2;

s1 := "Hello";
write (s1 || ", world");

s2 := s1 || ", world";
write (s2);

end


       IDENTIFICATION DIVISION.
       PROGRAM-ID. interpolation-included.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  extra PIC X(6) VALUE "little".

       PROCEDURE DIVISION.
           DISPLAY FUNCTION SUBSTITUTE("Mary had a X lamb.", "X", extra)

           GOBACK
           .


size = 'little'
console.log "Mary had a #size lamb."


size = 'little'
console.log "Mary had a #{size} lamb." # Mary had a little lamb.
console.log "Escaping: \#{}" # Escaping: #{}
console.log 'No #{ interpolation} with single quotes' # No #{ interpolation} with single quotes

# Multi-line strings and arbtrary expressions work: 20
console.log """
  Multi-line strings and arbtrary expressions work: #{ 5 * 4 }
  """


(let ((extra "little"))
  (format t "Mary had a ~A lamb.~%" extra))


void main() {
    import std.stdio, std.string;

    "Mary had a %s lamb.".format("little").writeln;
    "Mary had a %2$s %1$s lamb.".format("little", "white").writeln;
}


String s1 = 'Hello ';
String s2 = 'Salesforce Developer!';

String s3 = s1+s2;

// Print output
System.debug(s3);


try
    set endMsg to "world!"
    set totMsg to "Hello, " & endMsg
    display dialog totMsg
end try


/* ARM assembly Raspberry PI  */
/*  program strConcat.s   */

/* Constantes    */
.equ STDOUT, 1                           @ Linux output console
.equ EXIT,   1                           @ Linux syscall
.equ WRITE,  4                           @ Linux syscall
/* Initialized data */
.data
szMessFinal:   .asciz "The final string is \n"

szString:            .asciz "Hello "
szString1:           .asciz " the world. \n"

/* UnInitialized data */
.bss
szFinalString:   .skip 255

/*  code section */
.text
.global main
main:
                                         @ load string
    ldr r1,iAdrszString
	ldr r2,iAdrszFinalString
    mov r4,#0
1:
    ldrb r0,[r1,r4]                      @ load byte of string
    strb r0,[r2,r4]
    cmp r0,#0                            @ compar with zero ?
    addne r4,#1
    bne 1b
    ldr r1,iAdrszString1
    mov r3,#0
2:
    ldrb r0,[r1,r3]                      @ load byte of string 1
    strb r0,[r2,r4]
    cmp r0,#0                            @ compar with zero ?
    addne r4,#1
    addne r3,#1
    bne 2b
    mov r0,r2                            @ display final string
    bl affichageMess
100:                                     @ standard end of the program */
    mov r0, #0                           @ return code
    mov r7, #EXIT                        @ request to exit program
    svc 0                                @ perform the system call
iAdrszString:             .int szString
iAdrszString1:            .int szString1
iAdrszFinalString:       .int szFinalString
iAdrszMessFinal:          .int szMessFinal

/******************************************************************/
/*     display text with size calculation                         */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
    push {r0,r1,r2,r7,lr}                       @ save  registers
    mov r2,#0                                   @ counter length */
1:                                              @ loop length calculation
    ldrb r1,[r0,r2]                             @ read octet start position + index
    cmp r1,#0                                   @ if 0 its over
    addne r2,r2,#1                              @ else add 1 in the length
    bne 1b                                      @ and loop
                                                @ so here r2 contains the length of the message
    mov r1,r0                                   @ address message in r1
    mov r0,#STDOUT                              @ code to write to the standard output Linux
    mov r7, #WRITE                              @ code call system "write"
    svc #0                                      @ call systeme
    pop {r0,r1,r2,r7,lr}                        @ restaur des  2 registres
    bx lr                                       @ return


program Project1;

uses
  System.SysUtils;

var
  Template : string;
  Marker : string;
  Description : string;
  Value : integer;
  Output : string;

begin
  // StringReplace can be used if you are definitely using strings
  // http://docwiki.embarcadero.com/Libraries/XE7/en/System.SysUtils.StringReplace
  Template := 'Mary had a X lamb.';
  Marker := 'X';
  Description := 'little';
  Output := StringReplace(Template, Marker, Description, [rfReplaceAll, rfIgnoreCase]);
  writeln(Output);

  // You could also use format to do the same thing.
  // http://docwiki.embarcadero.com/Libraries/XE7/en/System.SysUtils.Format
  Template := 'Mary had a %s lamb.';
  Description := 'little';
  Output := format(Template,[Description]);
  writeln(Output);

  // Unlike StringReplace, format is not restricted to strings.
  Template := 'Mary had a %s lamb. It was worth $%d.';
  Description := 'little';
  Value := 20;
  Output := format(Template,[Description, Value]);
  writeln(Output);

end.


PrintLn(Format('Mary had a %s lamb.', ['little']))


let lamb_size = "little"
print("Mary had a \(lamb_size) lamb.")


def adjective := "little"
`Mary had a $adjective lamb`


str1: "Hello "
str2: "World"

print str1 ++ str2 ++ "!"


string s1 = "Hello";
write(s1 + " World!");
write(s1, " World!");
string s2 = s1 + " World!";
write(s2);


s := "hello"
Msgbox, %s%
s1 := s . "  literal" ;the . is optional
Msgbox, %s1%


BEGIN {
   s = "hello"
   print s " literal"
   s1 = s " literal"
   print s1
}


;; format uses %a or ~a as replacement directive
(format "Mary had a ~a lamb" "little")
   → "Mary had a little lamb"
(format "Mary had a %a lamb" "little")
   → "Mary had a little lamb"


IMPORT STD;
STD.Str.FindReplace('Mary had a X Lamb', 'X','little');


import extensions;

public program()
{
    var s := "little";
    console.printLineFormatted("Mary had a {0} lamb.",s).readChar()
}


x = "little"
IO.puts "Mary had a #{x} lamb"


(let ((little "little"))
  (format "Mary had a %s lamb." little)
  ;; message takes a format string as argument
  (message "Mary had a %s lamb." little))


7> S1 = "Mary had a ~s lamb".
8> S2 = lists:flatten( io_lib:format(S1, ["big"]) ).
9> S2.
"Mary had a big lamb"


Lbl CONCAT
Copy(r₁,L₁,length(r₁))
Copy(r₂,L₁+length(r₁),length(r₂)+1)
L₁
Return


s$ = "hello"
PRINT s$ + " literal"
s2$ = s$ + " literal"
PRINT s$
PRINT s2$


set string=Hello
echo %string% World
set string2=%string% World
echo %string2%


str ← "Hello "
newstr ← str ∾ "world"
•Show newstr


constant lambType = "little"
sequence s
s = sprintf("Mary had a %s lamb.",{lambType})
puts(1,s)


let lambType = "little"
printfn "Mary had a %s lamb." lambType


USE: formatting

SYMBOL: little

"little" little set

little get "Mary had a %s lamb" sprintf


/* created by Aykayayciti Earl Lamont Montgomery
April 9th, 2018 */

size = "little"
> @ "Mary had a $size lamb"

// line 1: use of the = operator
// line 2: use of the @ and $ operator


fansh> x := "little"
little
fansh> echo ("Mary had a $x lamb")
Mary had a little lamb


variable	     'src
variable	     #src
variable       'out
variable       #out

: Replace~     dup [char] ~  =                   \ test for  escape char
               if   'out @ 1+  #out @ type  drop \ replace the escape char
               else emit                         \ otherwise write  char
               then  ;
: format       0
               begin  dup  #src @ u<
               while  1+ dup 'src @ + [email protected]
                      replace~
               repeat ;

\ Test of  function
Here 'src ! ," Mary had a ~ lamb" here  'src @ - #src  !
page
cr ." Original        : "
'src @ 1+ #src @ type
cr ." 1st Replacement : "
  here 'out ! ," little" here 'out @ - #out !
  format
cr ." 2nd Replacement : "
  here 'out  ! ," BIG" here 'out @ - #out !
  format


"Hello ":?var1
& "World":?var2
& str$(!var1 !var2):?var12
& put$("var1=" !var1 ", var2=" !var2 ", var12=" !var12 "\n")


blsq ) "Hello, ""world!"?+
"Hello, world!"


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *sconcat(const char *s1, const char *s2)
{
  char *s0 = malloc(strlen(s1)+strlen(s2)+1);
  strcpy(s0, s1);
  strcat(s0, s2);
  return s0;
}

int main()
{
   const char *s = "hello";
   char *s2;

   printf("%s literal\n", s);
   /* or */
   printf("%s%s\n", s, " literal");

   s2 = sconcat(s, " literal");
   puts(s2);
   free(s2);
}


program interpolate

  write (*,*) trim(inter("Mary had a X lamb.","X","little"))

contains

  elemental function inter(string,place,ins) result(new)
    character(len=*), intent(in)                          :: string,place,ins
    character(len=len(string)+max(0,len(ins)-len(place))) :: new
    integer                                               :: idx
    idx = index(string,place)
    if ( idx == 0 ) then
      new = string
    else
      new = string(1:idx-1)//ins//string(idx+len(place):len(string))
    end if
  end function inter

end program interpolate


' FB 1.05.0 Win64

#Include "crt/stdio.bi"  '' header needed for printf

Dim x As String = "big"
Print "Mary had a "; x; " lamb"   '' FB's native Print statement
x = "little"
printf("Mary also had a %s lamb", x)
Sleep


x = "little"
println["Mary had a $x lamb."]


X = 'little'
println( "Mary had a $X lamb." )


using System;

class Program {
    static void Main(string[] args) {
        var s = "hello";
        Console.Write(s);
        Console.WriteLine(" literal");
        var s2 = s + " literal";
        Console.WriteLine(s2);
    }
}


#include <string>
#include <iostream>

int main() {
   std::string s = "hello";
   std::cout << s << " literal" << std::endl;
   std::string s2 = s + " literal";
   std::cout << s2 << std::endl;
   return 0;
}


"Hello" => string A;
A + " World!" => string B;
<<< B >>>;


Public Sub Main()

Print Subst("Mary had a &1 lamb", "little")

End


#listix#

   <how>   //little
   <what>  //has a @<how> lamb

   <main>  //Mary @<what>


package main

import (
    "fmt"
)

func main() {
    str := "Mary had a %s lamb"
    txt := "little"
    out := fmt.Sprintf(str, txt)
    fmt.Println(out)
}


def adj = 'little'
assert 'Mary had a little lamb.' == "Mary had a ${adj} lamb."


import Text.Printf

main = printf "Mary had a %s lamb\n" "little"


(def a-str "abcd")
(println (str a-str "efgh"))

(def a-new-str (str a-str "efgh"))
(println a-new-str)


       IDENTIFICATION DIVISION.
       PROGRAM-ID. Concat.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Str  PIC X(7) VALUE "Hello, ".
       01  Str2 PIC X(15).

       PROCEDURE DIVISION.
           DISPLAY "Str  : " Str
           STRING Str " World!" DELIMITED BY SIZE INTO Str2
           DISPLAY "Str2 : " Str2

           GOBACK
           .


(let ((s "hello"))
    (format t "~a there!~%" s)
    (let* ((s2 " there!")
           (s (concatenate 'string s s2)))
        (format t "~a~%" s)))


class Program {
  static function main() {
    var extra = 'little';
    var formatted = 'Mary had a $extra lamb.';
    Sys.println(formatted);
  }
}


CHARACTER original="Mary had a X lamb", little = "little", output_string*100

output_string = original
EDIT(Text=output_string, Right='X', RePLaceby=little)


  s2 := "humongous"
  s3 := "little"
  s1 :=  "Mary had a humongous lamb."
  s1 ?:= tab(find(s2)) || (=s2,s3) || tab(0)          # replaces the first instance of s2 with s3
  while s1 ?:= tab(find(s2)) || (=s2,s3) || tab(0)    # replaces all instances of s2 with s3, equivalent to replace


   require 'printf'
   'Mary had a %s lamb.' sprintf <'little'
Mary had a little lamb.

   require 'strings'
   ('%s';'little') stringreplace 'Mary had a %s lamb.'
Mary had a little lamb.
   'Mary had a %s lamb.' rplc '%s';'little'
Mary had a little lamb.


String original = "Mary had a X lamb";
String little = "little";
String replaced = original.replace("X", little); //does not change the original String
System.out.println(replaced);
//Alternative:
System.out.printf("Mary had a %s lamb.", little);
//Alternative:
String formatted = String.format("Mary had a %s lamb.", little);
System.out.println(formatted);


MODULE StringConcatenation;
IMPORT StdLog;

PROCEDURE Do*;
VAR
	str1,str2: ARRAY 128 OF CHAR;
BEGIN
	str1 := "Hello";
	str2 := str1 + " world";
	StdLog.String(":> " + str2);StdLog.Ln
END Do;

END StringConcatenation.


import std.stdio;

void main() {
    string s = "hello";
    writeln(s ~ " world");
    auto s2 = s ~ " world";
    writeln(s2);
}


$ string1 = "hello"
$ string2 = string1 + " world"
$ show symbol string*


program Concat;

{$APPTYPE CONSOLE}

var
  s1, s2: string;
begin
  s1 := 'Hello';
  s2 := s1 + ' literal';
  WriteLn(s1);
  WriteLn(s2);
end.


var original = "Mary had a X lamb";
var little = "little";
var replaced = original.replace("X", little); //does not change the original string


"little" as $x
  | "Mary had a \($x) lamb"


// version 1.0.6

fun main(args: Array<String>) {
   val s = "little"
    // String interpolation using a simple variable
    println("Mary had a $s lamb")

    // String interpolation using an expression (need to wrap it in braces)
    println("Mary had a ${s.toUpperCase()} lamb")

    // However if a simple variable is immediately followed by a letter, digit or underscore
    // it must be treated as an expression
    println("Mary had a ${s}r lamb") // not $sr
}


{def original Mary had a X lamb}
-> original
{def Y little}
-> Y
{S.replace X by {Y} in {original}}
-> Mary had a little lamb


email_merge("Mary had a #adjective# lamb", map("token"="little", "adjective"=""), null, 'plain')


var s1 := 'Hello';
var s2 := s1 + ' World';

PrintLn(s1);
PrintLn(s2);


var s = "hello"
print(s + " literal")
var s1 = s + " literal"
print(s1)


//to be compiled using dylan.NET v. 11.5.1.2 or later.
#refstdasm mscorlib.dll

import System

assembly concatex exe
ver 1.3.0.0

class public Program

   method public static void main()
        var s as string = "hello"
        Console::Write(s)
        Console::WriteLine(" literal")
        var s2 as string = s + " literal"
        Console::WriteLine(s2)
  end method

end class


local :s1 "hello"
local :s2 concat( s1 ", world" )
!print s2


local str="little"
put merge("Mary had a [[str]] lamb.")

-- Mary had a little lamb.


str = string.gsub( "Mary had a X lamb.", "X", "little" )
print( str )


module checkit {
      size$="little"
      m$=format$("Mary had a {0} lamb.", size$)
      Print m$
      Const RightJustify=1
      \\ format$(string_expression)  process escape codes
      Report RightJustify, format$(format$("Mary had a {0} {1} lamb.\r\n We use {0} for size, and {1} for color\r\n", size$, "wh"+"ite"))
      \\ we can use { } for multi line string
      Report RightJustify, format$({Mary had a {0} {1} lamb.
             We use {0} for size, and {1} for color
             }, size$, "wh"+"ite")
}
checkit


Extra = "little";
StringReplace["Mary had a X lamb.", {"X" -> Extra}]
->"Mary had a little lamb."


printf(true, "Mary had a ~a lamb", "little");


/**
 <doc>
String interpolation, in Neko

NekoVM String Library

 </doc>
**/

var sprintf = $loader.loadprim("[email protected]", 2)

$print(sprintf("Mary had a %s lamb\n", "little"))


a$ = "hello"
b$ = a$ & " world"
print b$


hello = "Hello"
hello'world = hello ++ ", " ++ "world"
(hello, hello'world)


public program()
{
    var s := "Hello";
    var s2 := s + " literal";

    console.writeLine:s;
    console.writeLine:s2;
    console.readChar()
}


s = "hello"
t = s <> " literal"

IO.puts s
IO.puts t


(defvar foo "foo")
(defvar foobar (concat foo "bar"))
(message "%sbar" foo)
(message "%s" foobar)


using System;
using System.Console;
using Nemerle.IO;  // contains printf() and print()

module Stringy
{
    Main() : void
    {
        def extra = "little";
        printf("Mary had a %s lamb.\n", extra);
        print("Mary had a $extra lamb.\n");
        WriteLine($"Mary had a $extra lamb.");
    }
}


/* NetRexx */

options replace format comments java crossref savelog symbols

import java.text.MessageFormat
import java.text.FieldPosition

useBif()
useMessageFormat()

return

method useBif public static

  st = "Mary had a %1$ lamb."
  si = 'little'

  say st.changestr('%1$', si)

  return

method useMessageFormat public static

  result = StringBuffer('')

  args = Object [                       -
    Object Integer(7),                  -
    Object Date(),                      -
    Object 'a disturbance in the Force' -
  ]
  msgfmt = MessageFormat('At {1, time} on {1, date}, there was {2} on planet {0, number, integer}.')
  result = msgfmt.format(args, result, FieldPosition(0))
  say result

  return


import strutils

var str = "little"
echo "Mary had a $# lamb".format(str)
echo "Mary had a $# lamb" % [str]
# Note: doesn't need an array for a single substitution, but uses an array for multiple substitutions.