Comma quibbling: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 2,951: | Line 2,951: | ||
func comma(text) |
func comma(text) |
||
listtext = [] |
listtext = [] |
||
for n = 1 to 4 |
for n = 1 to 4 |
||
listtext = str2list(substr(text[n], ",", nl)) |
listtext = str2list(substr(text[n], ",", nl)) |
||
if n = 2 |
if n = 2 |
||
see "{" + list2str(listtext) + "}" + nl |
see "{" + list2str(listtext) + "}" + nl |
||
loop |
loop |
||
ok |
ok |
||
if len(listtext) = 1 |
if len(listtext) = 1 |
||
see "{}" + nl |
see "{}" + nl |
||
loop |
loop |
||
ok |
ok |
||
str = "{" |
str = "{" |
||
for m = 1 to len(listtext)-1 |
for m = 1 to len(listtext)-1 |
||
if len(listtext) = 2 |
if len(listtext) = 2 |
||
str = str + listtext[m] + " " |
str = str + listtext[m] + " " |
||
else |
else |
||
str = str + listtext[m] + ", " |
str = str + listtext[m] + ", " |
||
ok |
ok |
||
next |
next |
||
if len(listtext) = 2 |
if len(listtext) = 2 |
||
str = left(str, len(str)-1) |
str = left(str, len(str)-1) |
||
else |
else |
||
str = left(str, len(str)-2) |
str = left(str, len(str)-2) |
||
ok |
ok |
||
if len(listtext) = 2 |
if len(listtext) = 2 |
||
str = str + " " + listtext[len(listtext)] + "}" |
str = str + " " + listtext[len(listtext)] + "}" |
||
else |
else |
||
str = str + " and " + listtext[len(listtext)] + "}" |
str = str + " and " + listtext[len(listtext)] + "}" |
||
ok |
ok |
||
see str + nl |
see str + nl |
||
next |
next |
||
</lang> |
</lang> |