forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreturn.lcdoc
More file actions
86 lines (67 loc) · 3.16 KB
/
Copy pathreturn.lcdoc
File metadata and controls
86 lines (67 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Name: return
Synonyms: cr, linefeed, lf
Type: constant
Syntax: return
Summary:
Equivalent to the line feed <character> (ASCII 10, Control-J).
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
local theData
put "Hello World" into theData
put return after word 1 of theData
Example:
local thisChar, aLongTextString
repeat for each char thisChar in aLongTextString
if thisChar is return then
exit repeat
else
-- do other stuff
end if
end repeat
Description:
Use the <return> <constant> as an easier-to-read substitute for
<numToChar>(10) or <numToCodepoint>(10).
The <return> <constant> is needed because you can't type the <character>
it represents in a <script|scripting> <statement>.
The <return> <constant> is a synonym for the line feed character
(<ASCII> 10, Control-J). This is different from some other languages, in
which <return> is equivalent to the carriage return <character> (<ASCII>
13, Control-M). For most purposes, LiveCode translates the linefeed
<constant> and its synonyms into the appropriate end-of-line <character>
for the current operating system. However, you should keep this nuance
in mind when processing data from another system, which LiveCode has not
translated: <return> is *not* <ASCII> 13.
The line feed character is the standard end-of-line <delimiter> on
<Unix> systems. The end-of-line <delimiter> for <Mac OS> systems is a
carriage return (<ASCII> 13), and the end-of-line <delimiter> for
<Windows> systems is a carriage return followed by a line feed (<ASCII>
13 + <ASCII> 10). Internally, LiveCode always uses a line feed (<ASCII>
10) to end lines.
>*Note:* If you specify text mode with the <open driver>, <open file>,
> or <open process> <command|commands>, LiveCode translates line
> feed <characters> to the appropriate end-of-line marker for the
> current <platform(glossary)> before writing data, and translates the
> current <platform(glossary)|platform's> end-of-line <delimiter> to a
> line feed after reading data. If you specify binary mode with
> these <command|commands>, LiveCode does not perform this automatic
> translation. Likewise, if you put data into a <file> <URL> or get data
> from it, end-of-line translation is performed, but not if you put data
> into or get data from a <binfile> <URL>.
>*Note:* Starting with LiveCode v. 7, all text is stored as <Unicode>.
> If you send text outside LiveCode you should convert it to the desired
> encoding using <textEncode>. If you receive text into LiveCode you
> should convert it to Unicode using <textDecode>.
Changes:
The LF synonym was added in version 2.0.
References: constant (command), open driver (command),
open file (command), open process (command), CRLF (constant),
formfeed (constant), numToChar (function), numToCodepoint (function),
platform (function), textEncode (function), textDecode (function),
ASCII (glossary), command (glossary), delimiter (glossary),
Mac OS (glossary), platform (glossary), statement (glossary),
Unix (glossary), Unicode (glossary), Windows (glossary),
binfile (keyword), character (keyword), characters (keyword),
file (keyword), URL (keyword), script (property)
Tags: text processing