More specifically I need to find out how to split a string into
substrings and how to concatenate substrings into one string.
For example I need a predicate that splits a string into atoms, like:
Split(' ','Split this string',S).
S = [Split,this,string]
Sorry to bother with such a 'simple' question...
TIA
M. Sorensen
Sent via Deja.com http://www.deja.com/
Before you buy.
This is indeed quite simple in Prolog.
Strings are just Lists of ASCII-Codes. So you can either say A=[97,98,99] or
you can say A="abc". This means the same in Prolog. And if you want to
concatenate two strings, you simply use append to do this:
?-append("simple","string",S).
S="simple string".
(prolog might print out the Ascii-list-representation at this point)
The suggested split predicate is now just a list manipulation task.
Tobias
mick...@hotmail.com schrieb in Nachricht <7vcioh$vv4$1...@nnrp1.deja.com>...
> This is indeed quite simple in Prolog.
> Strings are just Lists of ASCII-Codes.
...or of Unicode codes?
How many Prolog implementations are Unicode-capable
in the way that Java and (allegedly) Visual Basic are?
By which I think I mean that not only can a list-of-integers
accommodate 16-bit unsigned Unicode values, but that all
relevant built-in, library & GUI stuff handles Unicode strings
("uchars"?) consistently?
Paul Singleton
PS I don't really mean "how many" I mean "which " :-)
> "Tobias Göbel" wrote:
>
> > This is indeed quite simple in Prolog.
> > Strings are just Lists of ASCII-Codes.
>
> ...or of Unicode codes?
>
> How many Prolog implementations are Unicode-capable
> in the way that Java and (allegedly) Visual Basic are?
>
> By which I think I mean that not only can a list-of-integers
> accommodate 16-bit unsigned Unicode values, but that all
> relevant built-in, library & GUI stuff handles Unicode strings
> ("uchars"?) consistently?
SICStus Prolog 3.8 purports to do so (or generally any wide character
external encoding). Strings passed via the foreign language interface are
internally represented in UTF-8 encoding.
Mats Carlsson
Paul Singleton wrote:
> "Tobias Göbel" wrote:
>
> > This is indeed quite simple in Prolog.
> > Strings are just Lists of ASCII-Codes.
>
> ...or of Unicode codes?
>
> How many Prolog implementations are Unicode-capable
> in the way that Java and (allegedly) Visual Basic are?
>
> By which I think I mean that not only can a list-of-integers
> accommodate 16-bit unsigned Unicode values, but that all
> relevant built-in, library & GUI stuff handles Unicode strings
> ("uchars"?) consistently?
>