[ Strings and Atoms | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]
concat_strings(+Src1, +Src2, ?Dest)
Succeeds if Dest is the concatenation of Src1 and Src2.
- +Src1
- String.
- +Src2
- String.
- ?Dest
- String or variable.
Description
Dest is unified with the concatenation of Src1 and Src2.
Fail Conditions
Fails if Dest does not unify with the concatenation of Src1 and Src2.
Resatisfiable
No.
Exceptions
- (4) instantiation fault
- Either (or both) of Src1 and Src2 is not instantiated (non-coroutine mode only).
- (5) type error
- Either (or both) of Src1 and Src2 is instantiated, but not to a string.
- (5) type error
- Dest is neither a string nor a variable.
Examples
Success:
concat_strings("abc","def",X). (gives X="abcdef").
[eclipse]: [user].
absolutename(File,Abs) :-
string_list(File,List),
arg(1,List,0'/) -> Abs = File;
(getcwd(Cwd),
concat_strings(Cwd,File,Abs)).
user compiled 256 bytes in 0.02 seconds
yes.
[eclipse]: absolutename("d.pl",P), absolutename("/usr/bin",F).
P = "/home/lp/user/d.pl"
F = "/usr/bin"
yes.
Fail:
concat_strings("ab","bc","abc").
Error:
concat_strings("a",X,"ab"). (Error 4).
concat_strings("big",'gest',X). (Error 5).
See Also
append_strings / 3, concat_atoms / 3