Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 14-Nov-2014 17:16:13

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,477
Website

for whoever, two ways to build two lines

for whoever is wondering about this in the future or now, this came up in my learning about controlling the walkthrough plugit...

to create:

harry is the
best guy ever


you can use strcatn or strbuild

with strbuild:

fun main()=
_showconsole;
let strbuild ("harry"::"is"::"the"::nil)::("best"::"guy"::"ever"::nil)::nil-> string in
_fooS  string;
0;;

with strcatn:

fun main()=
_showconsole;
let 	strcatn  "harry"::" "::"is"::" "::"the"::" "::"\n"::"best"::" "::"guy"::"  "::"ever"::nil-> string in
_fooS string;
0;;

strbuild is shorter, but you have to keep track of those () symbols, strcatn is more typing but you don't have to worry about matching () symbols, but you do have to worry about all those "  " spaces, which (I at least) mess up when putting together strings in any programming language.

Offline

#2 14-Nov-2014 19:26:03

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: for whoever, two ways to build two lines

I wrote a sprintf function for that. It will be soon available, currently in test in Syspack library.

Example :

_fooS sprintf "%s is the %d %s" ["Christmas" 25 "december"];

Offline

Board footer

Powered by FluxBB