Saturday, June 24, 2017

#1 2005-10-13 02:48:54 pm

From: MalasaƱa, Madrid
Registered: 2002-11-20
Posts: 2014

What is the difference between "string" and "text"?

There is not practical difference between both "string" and "text" terms, as long as they concern to AppleScript.

However, there are some "theoretical" differences:
- String is some mac-roman text (mac ascii, 8-bit).
- Text can contain language and styles.

Anyway, if you ask about the class of a text, you will receive "string". And, more generally, you can call "text" to any kind of text: string, unicode text, international text, styled text, etc. When you call something "string", you usually mean "text which contains plain mac-ascii characters, without style information, script language or special encoding".

Actually, the plural of "string" maps to "plain text", and its usage is the same as "text" in expressions as:


text 1 thru 2 of {"kapullo", "k", "l"}
strings 1 thru 2 of {"kapullo", "k", "l"}

The main difference between "text" and "string" belongs to application developers, since they can define their own "type" ("TEXT" for string, "ctxt" for text) when they pass texts to AppleScript (eg, they can pass style information, as the clipboard, only mac-ascii characters, as Tex-Edit Plus, or even Unicode text -another kind of text-, as the Finder).



Board footer

Powered by FluxBB

[ Generated in 0.200 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)