Re: Standard Lib Func for string type?

new topic     » goto parent     » topic index » view thread      » older message » newer message
euphoric said...

Is there a function or type definition in the standard library for a string type? Basically, I just want to distinguish between "this is a string" and { "this is a string" }, one of which is a string and the other is a sequence of strings.

If there is not yet one, I would suggest at least an all_atoms() function, which returns True if all elements of the sequence are atoms.

-- Thats easy to determine 
 
include std/sequence.e 
 
procedure check(sequence s) 
if atom(s[$]) then 
puts(1,"It is a sequence\n") 
elsif sequence(s[$])  then 
puts(1,"It is a sequence in a sequence\n") 
else 
puts(1,"Do not know ?\n") 
end if 
end procedure 
 
sequence s1 = {"abcdefghi"}, s2 = "abcdefghi" 
 
check(s1) 
 
check(s2) 
 
if getc(0) then end if -- pause 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu