1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"1038.29">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica
; min-height: 22.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0000ee}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco
; min-height: 16.0px}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000; min-height: 12.0px}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060; min-height: 12.0px}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Helvetica
}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #cd1612}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #737373}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Helvetica
; color: #000000; min-height: 11.0px}
27 p
.p18
{margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Helvetica
; min-height: 18.0px}
28 p
.p19
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0000bf; min-height: 14.0px}
29 p
.p20
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
}
30 span
.s1
{font: 18.0px Helvetica
}
31 span
.s2
{color: #000000}
32 span
.s3
{color: #0000bf}
33 span
.s4
{color: #606060}
34 span
.s5
{color: #bf0000}
35 span
.s6
{color: #737373}
36 span
.s7
{text-decoration: underline
}
37 span
.s8
{font: 12.0px Helvetica
}
38 span
.s9
{font: 9.0px Helvetica
}
39 span
.Apple-tab-span
{white-space:pre
}
43 <p class=
"p1"><span class=
"s1"><b>String
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>array of characters
</b></p>
44 <p class=
"p2"><br></p>
45 <p class=
"p3"><span class=
"s2"><b>Inherits from:
</b><a href=
"../Core/Object.html"><b>Object
</b></a><b> :
</b><a href=
"Collection.html"><b>Collection
</b></a></span><span class=
"s3"><b> :
</b></span><span class=
"s2"><b> </b><a href=
"SequenceableCollection.html"><b>SequenceableCollection
</b></a></span><span class=
"s3"><b> :
</b><a href=
"ArrayedCollection.html"><b>ArrayedCollection
</b></a><b> :
</b></span><span class=
"s2"><b> </b><a href=
"RawArray.html"><span class=
"s3"><b>RawArray
</b></span></a></span></p>
46 <p class=
"p4"><br></p>
47 <p class=
"p1">String represents an array of characters.
</p>
48 <p class=
"p1">Strings can be written literally using double quotes:
</p>
49 <p class=
"p4"><br></p>
50 <p class=
"p5"><span class=
"s4">"my string"</span>.class.postln;
</p>
51 <p class=
"p6"><br></p>
52 <p class=
"p7"><b>Class Methods
</b></p>
53 <p class=
"p4"><br></p>
54 <p class=
"p1"><b>*readNew(file)
</b></p>
55 <p class=
"p4"><br></p>
56 <p class=
"p1">Read the entire contents of a
<b>File
</b> and return them as a new String.
</p>
57 <p class=
"p4"><br></p>
58 <p class=
"p7"><b>Instance Methods
</b></p>
59 <p class=
"p4"><br></p>
60 <p class=
"p1"><b>at(index)
</b></p>
61 <p class=
"p4"><br></p>
62 <p class=
"p1">Strings respond to .at in a manner similar to other indexed collections. Each element is a
<b>Char
</b>.
</p>
63 <p class=
"p4"><br></p>
64 <p class=
"p5"><span class=
"s4">"ABCDEFG"</span>.at(
2).postln;
</p>
65 <p class=
"p4"><br></p>
66 <p class=
"p1"><b>compare(aString)
</b></p>
67 <p class=
"p4"><br></p>
68 <p class=
"p1">Returns a -
1,
0, or
1 depending on whether the receiver should be sorted before the argument,
</p>
69 <p class=
"p1">is equal to the argument or should be sorted after the argument. This is a case sensitive compare.
</p>
70 <p class=
"p4"><br></p>
71 <p class=
"p1"><b>< aString
</b></p>
72 <p class=
"p4"><br></p>
73 <p class=
"p1">Returns a Boolean whether the receiver should be sorted before the argument.
</p>
74 <p class=
"p4"><br></p>
75 <p class=
"p1"><b>== aString
</b></p>
76 <p class=
"p4"><br></p>
77 <p class=
"p1">Returns a Boolean whether the two Strings are equal.
</p>
78 <p class=
"p4"><br></p>
79 <p class=
"p1"><b>post
</b></p>
80 <p class=
"p4"><br></p>
81 <p class=
"p1">Prints the string to the current post window.
</p>
82 <p class=
"p4"><br></p>
83 <p class=
"p1"><b>postln
</b></p>
84 <p class=
"p4"><br></p>
85 <p class=
"p1">Prints the string and a carriage return to the current post window.
</p>
86 <p class=
"p4"><br></p>
87 <p class=
"p1"><b>postc
<span class=
"Apple-tab-span"> </span>postcln
</b></p>
88 <p class=
"p4"><br></p>
89 <p class=
"p1">As post and postln above, but formatted as a comment.
</p>
90 <p class=
"p4"><br></p>
91 <p class=
"p8">"This is a comment.".postcln;
</p>
92 <p class=
"p9"><br></p>
93 <p class=
"p9"><br></p>
94 <p class=
"p1"><b>postf
</b></p>
95 <p class=
"p4"><br></p>
96 <p class=
"p1">Prints a formatted string with arguments to the current post window. The % character in the format string is replaced by a string representation of an argument. To print a % character use \\% .
</p>
97 <p class=
"p9"><br></p>
98 <p class=
"p5">postf(
"this % a %. pi = %, list = %\n",
"is",
"test", pi.round(
1e-4), (
1.
.4))
</p>
99 <p class=
"p9"><br></p>
100 <p class=
"p5">this is a test. pi =
3.1416, list = [
1,
2,
3,
4 ]
</p>
101 <p class=
"p9"><br></p>
102 <p class=
"p1"><b>format
</b></p>
103 <p class=
"p4"><br></p>
104 <p class=
"p1">Returns a formatted string with arguments. The % character in the format string is replaced by a string representation of an argument. To print a % character use \\% .
</p>
105 <p class=
"p9"><br></p>
106 <p class=
"p5">format(
"this % a %. pi = %, list = %\n",
"is",
"test", pi.round(
1e-4), (
1.
.4))
</p>
107 <p class=
"p4"><br></p>
108 <p class=
"p5">this is a test. pi =
3.1416, list = [
1,
2,
3,
4 ]
</p>
109 <p class=
"p9"><br></p>
110 <p class=
"p1"><b>matchRegexp(string, start, end)
</b></p>
111 <p class=
"p9"><br></p>
112 <p class=
"p1">POSIX regular expression matching.
<span class=
"Apple-converted-space"> </span></p>
113 <p class=
"p1">Returns true if the receiver (a regular expression pattern) matches the string passed to it.
</p>
114 <p class=
"p1">The
<b>start
</b> is an offset where to start searching in the string (default:
0),
<b>end
</b> where to stop.
</p>
115 <p class=
"p4"><br></p>
116 <p class=
"p5"><span class=
"s4">"c"</span>.matchRegexp(
<span class=
"s4">"abcdefg"</span>,
2,
5);
<span class=
"s5">// true
</span></p>
117 <p class=
"p5"><span class=
"s4">"c"</span>.matchRegexp(
<span class=
"s4">"abcdefg"</span>,
4,
5);
<span class=
"s5">// false
</span></p>
118 <p class=
"p9"><br></p>
119 <p class=
"p8">"behaviou?r".matchRegexp(
"behavior");
<span class=
"s5">// true
</span></p>
120 <p class=
"p8">"behaviou?r".matchRegexp(
"behaviour");
<span class=
"s5">// true
</span></p>
121 <p class=
"p8">"behaviou?r".matchRegexp(
"behavir");
<span class=
"s5">// false
</span></p>
122 <p class=
"p8">"b.h.v.r".matchRegexp(
"behavor");
<span class=
"s5">// true
</span></p>
123 <p class=
"p8">"b.h.vi*r".matchRegexp(
"behaviiiiir");
<span class=
"s5">// true
</span></p>
124 <p class=
"p5"><span class=
"s4">"(a|u)nd"</span>.matchRegexp(
<span class=
"s4">"und"</span>);
<span class=
"s5">// true
</span></p>
125 <p class=
"p5"><span class=
"s4">"(a|u)nd"</span>.matchRegexp(
<span class=
"s4">"and"</span>);
<span class=
"s5">// true
</span></p>
126 <p class=
"p5"><span class=
"s4">"[a-c]nd"</span>.matchRegexp(
<span class=
"s4">"ind"</span>);
<span class=
"s5">// false
</span></p>
127 <p class=
"p5"><span class=
"s4">"[a-c]nd"</span>.matchRegexp(
<span class=
"s4">"bnd"</span>);
<span class=
"s5">// true
</span></p>
128 <p class=
"p10"><br></p>
129 <p class=
"p1"><b>findRegexp(string)
</b></p>
130 <p class=
"p10"><br></p>
131 <p class=
"p1">POSIX regular expression search.
<span class=
"Apple-converted-space"> </span></p>
132 <p class=
"p9"><br></p>
133 <p class=
"p5">"foobar".findRegexp(
"o*bar");
</p>
134 <p class=
"p9"><br></p>
135 <p class=
"p5">"32424 334 /**aaaaaa*/".findRegexp(
"/\\*\\*a*\\*/");
</p>
136 <p class=
"p9"><br></p>
137 <p class=
"p5">"foobar".findRegexp(
"(o*)(bar)");
</p>
138 <p class=
"p9"><br></p>
139 <p class=
"p5">"aaaabaaa".findAllRegexp(
"a+");
</p>
140 <p class=
"p10"><br></p>
141 <p class=
"p4"><br></p>
142 <p class=
"p1"><b>error
</b></p>
143 <p class=
"p4"><br></p>
144 <p class=
"p1">Prepends an error banner and posts the string
</p>
145 <p class=
"p4"><br></p>
146 <p class=
"p1"><b>warn
</b></p>
147 <p class=
"p4"><br></p>
148 <p class=
"p1">Prepends a warning banner and posts the string.
</p>
149 <p class=
"p4"><br></p>
150 <p class=
"p1"><b>inform
</b></p>
151 <p class=
"p4"><br></p>
152 <p class=
"p1">Posts the string.
</p>
153 <p class=
"p4"><br></p>
154 <p class=
"p1"><b>++ aString
</b></p>
155 <p class=
"p4"><br></p>
156 <p class=
"p1">Return a concatenation of the two strings.
</p>
157 <p class=
"p4"><br></p>
158 <p class=
"p1"><b>+ aString
</b></p>
159 <p class=
"p4"><br></p>
160 <p class=
"p1">Return a concatenation of the two strings with a space between them.
</p>
161 <p class=
"p4"><br></p>
162 <p class=
"p1"><b>compile
</b></p>
163 <p class=
"p4"><br></p>
164 <p class=
"p1">Compiles a String containing legal SuperCollider code and returns a Function.
</p>
165 <p class=
"p4"><br></p>
167 <p class=
"p5"><span class=
"s3">var
</span> f;
</p>
168 <p class=
"p5">f =
<span class=
"s4">"2 + 1"</span>.compile.postln;
</p>
169 <p class=
"p5">f.value.postln;
</p>
171 <p class=
"p6"><br></p>
172 <p class=
"p1"><b>asCompileString
</b></p>
173 <p class=
"p4"><br></p>
174 <p class=
"p1">Returns a String formatted for compiling.
</p>
175 <p class=
"p4"><br></p>
177 <p class=
"p5"><span class=
"s3">var
</span> f;
</p>
178 <p class=
"p5">f =
"myString";
</p>
179 <p class=
"p5">f.postln;
</p>
180 <p class=
"p5">f.asCompileString.postln;
</p>
182 <p class=
"p4"><br></p>
183 <p class=
"p1"><b>postcs
</b></p>
184 <p class=
"p4"><br></p>
185 <p class=
"p1">As postln, but posts the compileString of the reciever
</p>
186 <p class=
"p4"><br></p>
187 <p class=
"p5"><span class=
"s3">List
</span>[
1,
2, [
<span class=
"s4">"comment"</span>, [
3,
2]], {
1.0.rand }].postcs;
</p>
188 <p class=
"p4"><br></p>
189 <p class=
"p1"><b>interpret
</b></p>
190 <p class=
"p4"><br></p>
191 <p class=
"p1">Compile and execute a String containing legal SuperCollider code, returning the result.
</p>
192 <p class=
"p6"><br></p>
193 <p class=
"p5"><span class=
"s4">"2 + 1"</span>.interpret.postln;
</p>
194 <p class=
"p4"><br></p>
195 <p class=
"p1"><b>interpretPrint
</b></p>
196 <p class=
"p4"><br></p>
197 <p class=
"p1">Compile, execute and print the result of a String containing legal SuperCollider code.
</p>
198 <p class=
"p6"><br></p>
199 <p class=
"p5"><span class=
"s4">"2 + 1"</span>.interpretPrint;
</p>
200 <p class=
"p4"><br></p>
201 <p class=
"p1"><b>asSymbol
</b></p>
202 <p class=
"p4"><br></p>
203 <p class=
"p1">Return a Symbol derived from the String.
</p>
204 <p class=
"p6"><br></p>
206 <p class=
"p5"><span class=
"s3">var
</span> z;
</p>
207 <p class=
"p5">z =
<span class=
"s4">"myString"</span>.asSymbol.postln;
</p>
208 <p class=
"p5">z.class.postln;
</p>
210 <p class=
"p4"><br></p>
211 <p class=
"p1"><b>asInteger
</b></p>
212 <p class=
"p4"><br></p>
213 <p class=
"p1">Return an Integer derived from the String. Strings beginning with non-numeric characters return
0.
</p>
214 <p class=
"p6"><br></p>
215 <p class=
"p5"><span class=
"s4">"4"</span>.asInteger.postln;
</p>
216 <p class=
"p6"><br></p>
217 <p class=
"p1"><b>asFloat
</b></p>
218 <p class=
"p4"><br></p>
219 <p class=
"p1">Return a Float derived from the String. Strings beginning with non-numeric characters return
0.
</p>
220 <p class=
"p6"><br></p>
221 <p class=
"p5"><span class=
"s4">"4.3"</span>.asFloat.postln;
</p>
222 <p class=
"p6"><br></p>
223 <p class=
"p1"><b>asSecs
</b></p>
224 <p class=
"p4"><br></p>
225 <p class=
"p1">Return a Float based on converting a time string in format (dd):hh:mm:ss.s.
</p>
226 <p class=
"p1">This is the inverse method to SimpleNumber:asTimeString.
<span class=
"Apple-converted-space"> </span></p>
227 <p class=
"p6"><span class=
"Apple-converted-space"> </span></p>
228 <p class=
"p11">(
45296.asTimeString).asSecs;
</p>
229 <p class=
"p11">"32.1".asSecs;
</p>
230 <p class=
"p11">"62.1".asSecs;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// warns
</p>
231 <p class=
"p11">"0:0:59.9".asSecs;
</p>
232 <p class=
"p11">"1:1:1.1".asSecs;
</p>
233 <p class=
"p11">"-1".asSecs;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// neg sign supported
</p>
234 <p class=
"p11">"-12:34:56".asSecs;
</p>
235 <p class=
"p11">"12:-34:56".asSecs;
<span class=
"Apple-tab-span"> </span>// warns
</p>
236 <p class=
"p11">"-23:12.3456".asSecs;
<span class=
"Apple-tab-span"> </span>//
</p>
237 <p class=
"p11">"-1:00:00:00".asSecs;
<span class=
"Apple-tab-span"> </span>// days too.
</p>
238 <p class=
"p6"><br></p>
239 <p class=
"p1"><b>catArgs(... args)
</b></p>
240 <p class=
"p4"><br></p>
241 <p class=
"p1">Concatenate this string with the following args.
</p>
242 <p class=
"p6"><br></p>
243 <p class=
"p5"><span class=
"s4">"These are some args: "</span>.catArgs(
<span class=
"s5">\fish
</span>,
<span class=
"s3">SinOsc
</span>.ar, {
4 +
3}).postln;
</p>
244 <p class=
"p6"><br></p>
245 <p class=
"p1"><b>scatArgs(... args)
</b></p>
246 <p class=
"p4"><br></p>
247 <p class=
"p1">Same as catArgs, but with spaces in between.
</p>
248 <p class=
"p6"><br></p>
249 <p class=
"p5"><span class=
"s4">"These are some args: "</span>.scatArgs(
<span class=
"s5">\fish
</span>,
<span class=
"s3">SinOsc
</span>.ar, {
4 +
3}).postln;
</p>
250 <p class=
"p6"><br></p>
251 <p class=
"p1"><b>ccatArgs(... args)
</b></p>
252 <p class=
"p4"><br></p>
253 <p class=
"p1">Same as catArgs, but with commas in between.
</p>
254 <p class=
"p6"><br></p>
255 <p class=
"p5"><span class=
"s4">"a String"</span>.ccatArgs(
<span class=
"s5">\fish
</span>,
<span class=
"s3">SinOsc
</span>.ar, {
4 +
3}).postln;
</p>
256 <p class=
"p6"><br></p>
257 <p class=
"p1"><b>catList(list)
<span class=
"Apple-tab-span"> </span>scatList(list)
<span class=
"Apple-tab-span"> </span>ccatList(list)
</b></p>
258 <p class=
"p4"><br></p>
259 <p class=
"p1">As catArgs, scatArgs and ccatArgs above, but takes a Collection (usually a List or an Array) as an argument.
<span class=
"Apple-converted-space"> </span></p>
260 <p class=
"p6"><br></p>
261 <p class=
"p5"><span class=
"s4">"a String"</span>.ccatList([
<span class=
"s5">\fish
</span>,
<span class=
"s3">SinOsc
</span>.ar, {
4 +
3}]).postln;
</p>
262 <p class=
"p6"><br></p>
263 <p class=
"p1"><b>split(separator)
</b></p>
264 <p class=
"p4"><br></p>
265 <p class=
"p1">Returns an Array of Strings split at the separator. The separator is a
<b>Char
</b>, and is not included in the output array. The default separator is $/, handy for Unix paths.
</p>
266 <p class=
"p6"><br></p>
267 <p class=
"p8">"This/could/be/a/Unix/path".split.postln;
</p>
268 <p class=
"p8">"These are several words".split($ ).postln;
</p>
269 <p class=
"p9"><br></p>
270 <p class=
"p1"><b>ascii
</b></p>
271 <p class=
"p4"><br></p>
272 <p class=
"p1">Returns an Array of asci numbers of the Strings's characters.
</p>
273 <p class=
"p6"><br></p>
274 <p class=
"p8">"wertvoll".ascii;
</p>
275 <p class=
"p6"><br></p>
276 <p class=
"p6"><br></p>
277 <p class=
"p1"><b>find(string, ignoreCase, offset)
</b></p>
278 <p class=
"p4"><br></p>
279 <p class=
"p1">Returns the index of the string in the receiver, or nil if not found. If
<b>ignoreCase
</b> is true, find makes no difference between uppercase and lowercase letters. The
<b>offset
</b> is the point in the string where the search begins.
</p>
280 <p class=
"p6"><br></p>
281 <p class=
"p8">"These are several words".find(
"are").postln;
</p>
282 <p class=
"p8">"These are several words".find(
"fish").postln;
</p>
283 <p class=
"p9"><br></p>
284 <p class=
"p1"><b>findBackwards(string, ignoreCase, offset)
</b></p>
285 <p class=
"p4"><br></p>
286 <p class=
"p1">Same like find, but starts at the end of the string.
</p>
287 <p class=
"p6"><br></p>
288 <p class=
"p11">// compare:
</p>
289 <p class=
"p8">"These words are several words".find(
"words");
<span class=
"s5">//
6</span></p>
290 <p class=
"p8">"These words are several words".findBackwards(
"words");
<span class=
"s5">//
24</span></p>
291 <p class=
"p9"><br></p>
292 <p class=
"p1"><b>findAll(string,
<span class=
"Apple-converted-space"> </span>ignoreCase, offset)
</b></p>
293 <p class=
"p4"><br></p>
294 <p class=
"p1">Returns the indices of the string in the receiver, or nil if not found.
</p>
295 <p class=
"p6"><br></p>
296 <p class=
"p8">"These are several words which are fish".findAll(
"are").postln;
</p>
297 <p class=
"p8">"These are several words which are fish".findAll(
"fish").postln;
</p>
298 <p class=
"p6"><br></p>
299 <p class=
"p1"><b>contains(string)
</b></p>
300 <p class=
"p4"><br></p>
301 <p class=
"p1">Returns a
<b>Boolean
</b> indicating if the String contains string.
</p>
302 <p class=
"p6"><br></p>
303 <p class=
"p8">"These are several words".contains(
"are").postln;
</p>
304 <p class=
"p8">"These are several words".contains(
"fish").postln;
</p>
305 <p class=
"p6"><br></p>
306 <p class=
"p1"><b>containsi(string)
</b></p>
307 <p class=
"p4"><br></p>
308 <p class=
"p1">Same as contains, but case insensitive.
</p>
309 <p class=
"p6"><br></p>
310 <p class=
"p8">"These are several words".containsi(
"ArE").postln;
</p>
311 <p class=
"p4"><br></p>
312 <p class=
"p1"><b>containsStringAt(index, string)
</b></p>
313 <p class=
"p4"><br></p>
314 <p class=
"p1">Returns a
<b>Boolean
</b>indicating if the String contains string beginning at the specified index.
</p>
315 <p class=
"p6"><br></p>
316 <p class=
"p5"><span class=
"s4">"These are several words"</span>.containsStringAt(
6,
<span class=
"s4">"are"</span>).postln;
</p>
317 <p class=
"p6"><br></p>
318 <p class=
"p1"><b>icontainsStringAt(index, string)
</b></p>
319 <p class=
"p4"><br></p>
320 <p class=
"p1">Same as containsStringAt, but case insensitive.
</p>
321 <p class=
"p4"><br></p>
322 <p class=
"p1"><b>escapeChar(charToEscape)
</b></p>
323 <p class=
"p4"><br></p>
324 <p class=
"p1">Add the escape character (\) at the location of your choice.
</p>
325 <p class=
"p4"><br></p>
326 <p class=
"p8">"This will become a Unix friendly string".escapeChar($ ).postln;
</p>
327 <p class=
"p6"><br></p>
328 <p class=
"p1"><b>tr(from, to)
</b></p>
329 <p class=
"p4"><br></p>
330 <p class=
"p1">Transliteration. Replace all instances of from with to.
</p>
331 <p class=
"p4"><br></p>
332 <p class=
"p11"><span class=
"s4">":-(:-(:-("</span>.tr($(, $)); //turn the frowns upside down
</p>
333 <p class=
"p10"><br></p>
334 <p class=
"p1"><b>replace(find, replace)
</b></p>
335 <p class=
"p4"><br></p>
336 <p class=
"p1">Like
<b>tr
</b>, but with strings as arguments.
</p>
337 <p class=
"p12"><br></p>
338 <p class=
"p8">"Here are several words which are fish".replace(
"are",
"were");
</p>
339 <p class=
"p6"><br></p>
340 <p class=
"p1"><b>printOn(stream)
</b></p>
341 <p class=
"p4"><br></p>
342 <p class=
"p1">Print the String on stream.
</p>
343 <p class=
"p4"><br></p>
344 <p class=
"p8">"Print this on Post".printOn(
<span class=
"s3">Post
</span>);
</p>
345 <p class=
"p9"><br></p>
346 <p class=
"p11">// equivalent to:
</p>
347 <p class=
"p8"><span class=
"s3">Post
</span> << "Print this on Post";
</p>
348 <p class=
"p6"><br></p>
349 <p class=
"p1"><b>storeOn(stream)
</b></p>
350 <p class=
"p4"><br></p>
351 <p class=
"p1">Same as printOn, but formatted asCompileString.
</p>
352 <p class=
"p4"><br></p>
353 <p class=
"p8">"Store this on Post".storeOn(
<span class=
"s3">Post
</span>);
</p>
354 <p class=
"p9"><br></p>
355 <p class=
"p11">// equivalent to:
</p>
356 <p class=
"p8"><span class=
"s3">Post
</span> <<< "Store this on Post";
</p>
357 <p class=
"p6"><br></p>
358 <p class=
"p1"><b>inspectorClass
</b></p>
359 <p class=
"p4"><br></p>
360 <p class=
"p1">Returns class StringInspector.
</p>
361 <p class=
"p4"><br></p>
362 <p class=
"p1"><b>stripRTF
</b></p>
363 <p class=
"p4"><br></p>
364 <p class=
"p1">Returns a new String with all RTF formatting removed.
</p>
365 <p class=
"p4"><br></p>
367 <p class=
"p11">// same as File-readAllStringRTF
</p>
368 <p class=
"p5">g =
<span class=
"s3">File
</span>(
"/code/SuperCollider3/build/Help/UGens/Chaos/HenonC.help.rtf",
"r");
</p>
369 <p class=
"p5">g.readAllString.stripRTF.postln;
</p>
370 <p class=
"p5">g.close;
</p>
372 <p class=
"p4"><br></p>
373 <p class=
"p13"><b>Unix Support
</b></p>
374 <p class=
"p4"><br></p>
375 <p class=
"p1">Where relevant, the current working directory is the same as the location of the SuperCollider app and the shell is the Bourne shell (sh). Note that the cwd, and indeed the shell itself, does not persist:
</p>
376 <p class=
"p4"><br></p>
377 <p class=
"p14"><span class=
"s6">"echo $0"</span><span class=
"s2">.unixCmd;
</span>// print the shell (sh)
</p>
378 <p class=
"p15"><span class=
"s6">"pwd"</span>.unixCmd;
</p>
379 <p class=
"p16">"cd Help/"<span class=
"s2">.unixCmd;
</span></p>
380 <p class=
"p15"><span class=
"s6">"pwd"</span>.unixCmd;
</p>
381 <p class=
"p17"><br></p>
382 <p class=
"p16">"export FISH=mackerel"<span class=
"s2">.unixCmd;
</span></p>
383 <p class=
"p16">"echo $FISH"<span class=
"s2">.unixCmd;
</span></p>
384 <p class=
"p4"><br></p>
385 <p class=
"p1">It is however possible to execute complex commands:
</p>
386 <p class=
"p4"><br></p>
387 <p class=
"p16">"pwd; cd Help/; pwd"<span class=
"s2">.unixCmd;
</span></p>
388 <p class=
"p16">"export FISH=mackerel; echo $FISH"<span class=
"s2">.unixCmd;
</span></p>
389 <p class=
"p12"><br></p>
390 <p class=
"p1">Also on os x applescript can be called via osascript:
</p>
391 <p class=
"p4"><br></p>
392 <p class=
"p16">"osascript -e 'tell application \"Safari\
" to activate'"<span class=
"s2">.unixCmd;
</span></p>
393 <p class=
"p6"><br></p>
394 <p class=
"p1">Should you need an environment variable to persist you can use
<b>setenv
</b> (see below).
</p>
395 <p class=
"p4"><br></p>
396 <p class=
"p1"><b>NOTE:
</b> Despite the fact that the method is called 'unixCmd',
<b>it does work in Windows
</b>. The string must be a DOS command, however:
"dir" rather than
"ls" for instance.
</p>
397 <p class=
"p4"><br></p>
398 <p class=
"p1"><b>unixCmd(action, postOutput)
</b></p>
399 <p class=
"p4"><br></p>
400 <p class=
"p1">Execute the String on the command line using the Bourne shell (sh). Returns the pid of the newly created process (use Integer.pidRunning to test if a pid is alive). action is a Function that is called when the process has exited. It is passed two arguments: the exit code and pid of the exited process. postOutput is a Boolean that controls whether or not the output of the process is displayed in the post window.
</p>
401 <p class=
"p4"><br></p>
402 <p class=
"p5"><span class=
"s4">"ls Help"</span>.unixCmd;
</p>
403 <p class=
"p4"><br></p>
404 <p class=
"p5"><span class=
"s4">"echo one; sleep 1; echo two; sleep 1"</span>.unixCmd {
<span class=
"s3">|res, pid|
</span> [\done, res, pid].postln };
</p>
405 <p class=
"p4"><br></p>
406 <p class=
"p1"><b>unixCmdGetStdOut
</b></p>
407 <p class=
"p4"><br></p>
408 <p class=
"p1">Similar to unixCmd except that the stdout of the process is returned (synchronously) rather than sent to the post window.
</p>
409 <p class=
"p4"><br></p>
410 <p class=
"p5">~listing =
<span class=
"s4">"ls Help"</span>.unixCmdGetStdOut;
<span class=
"s5">// Grab
</span></p>
411 <p class=
"p5">~listing.reverse.as(
<span class=
"s3">Array
</span>).stutter.join.postln;
<span class=
"s5">// Mangle
</span></p>
412 <p class=
"p4"><br></p>
413 <p class=
"p1"><b>runInTerminal
</b></p>
414 <p class=
"p4"><br></p>
415 <p class=
"p1">Execute the String in a new terminal window. (The string is incorporated into a temporary script file and executed using a shell.
"/usr/bash" is the default shell used but you can optionally specify which shell to use as an argument.)
</p>
416 <p class=
"p4"><br></p>
417 <p class=
"p8">"echo ---------Hello delightful SuperCollider user----------".runInTerminal;
</p>
418 <p class=
"p4"><br></p>
419 <p class=
"p1"><b>setenv(value)
</b></p>
420 <p class=
"p4"><br></p>
421 <p class=
"p1">Set the environment variable indicated in the string to equal the String
<b>value
</b>. This value will persist until it is changed or SC is quit. Note that if
<b>value
</b> is a path you may need to call standardizePath on it (see below).
</p>
422 <p class=
"p4"><br></p>
423 <p class=
"p11">// all defs in this directory will be loaded when a local server boots
</p>
424 <p class=
"p8">"SC_SYNTHDEF_PATH".setenv(
"~/scwork/".standardizePath);
<span class=
"Apple-converted-space"> </span></p>
425 <p class=
"p8">"echo $SC_SYNTHDEF_PATH".unixCmd;
</p>
426 <p class=
"p4"><br></p>
427 <p class=
"p1"><b>getenv
</b></p>
428 <p class=
"p4"><br></p>
429 <p class=
"p1">Returns the value contained in the environment variable indicated by the String.
</p>
430 <p class=
"p4"><br></p>
431 <p class=
"p5"><span class=
"s4">"USER"</span>.getenv;
</p>
432 <p class=
"p4"><br></p>
433 <p class=
"p1"><b>pathMatch
</b></p>
434 <p class=
"p4"><br></p>
435 <p class=
"p1">Returns an
<b>Array
</b> containing all paths matching this String. Wildcards apply, non-recursive.
</p>
436 <p class=
"p4"><br></p>
437 <p class=
"p5"><span class=
"s3">Post
</span> << <span class=
"s4">"Help/*"</span>.pathMatch;
</p>
438 <p class=
"p6"><br></p>
439 <p class=
"p1"><b>loadPaths
</b></p>
440 <p class=
"p4"><br></p>
441 <p class=
"p1">Perform pathMatch (see above) on this String, then load and execute all paths in the resultant
<b>Array
</b>.
</p>
442 <p class=
"p4"><br></p>
443 <p class=
"p8">"Help/Collections/loadPaths example.scd".loadPaths;
<span class=
"s5">//This file posts some text
</span></p>
444 <p class=
"p6"><br></p>
445 <p class=
"p1"><b>load
</b></p>
446 <p class=
"p4"><br></p>
447 <p class=
"p1">Load and execute the file at the path represented by the receiver.
</p>
448 <p class=
"p4"><br></p>
449 <p class=
"p1"><b>loadRelative
</b></p>
450 <p class=
"p4"><br></p>
451 <p class=
"p1">Load and execute the file at the path represented by the receiver, interpreting the path as relative to the current document or text file. Requires that the file has been saved.
</p>
452 <p class=
"p4"><br></p>
453 <p class=
"p1"><b>resolveRelative
</b></p>
454 <p class=
"p4"><br></p>
455 <p class=
"p1">Convert the receiver from a relative path to an absolute path, relative to the current document or text file. Requires that the current text file has been saved. Absolute paths are left untransformed.
</p>
456 <p class=
"p6"><br></p>
457 <p class=
"p1"><b>standardizePath
</b></p>
458 <p class=
"p4"><br></p>
459 <p class=
"p1">Expand ~ to your home directory, and resolve symbolic links. See
<b>PathName
</b>for more complex needs.
</p>
460 <p class=
"p4"><br></p>
461 <p class=
"p11"><span class=
"s4">"~/"</span>.standardizePath; //This will print your home directory
</p>
462 <p class=
"p6"><br></p>
463 <p class=
"p1"><b>basename
</b></p>
464 <p class=
"p4"><br></p>
465 <p class=
"p1">Return the filename from a Unix path.
</p>
466 <p class=
"p4"><br></p>
467 <p class=
"p8">"Imaginary/Directory/fish.rtf".basename;
</p>
468 <p class=
"p6"><br></p>
469 <p class=
"p1"><b>dirname
</b></p>
470 <p class=
"p4"><br></p>
471 <p class=
"p1">Return the directory name from a Unix path.
</p>
472 <p class=
"p4"><br></p>
473 <p class=
"p8">"Imaginary/Directory/fish.rtf".dirname;
</p>
474 <p class=
"p6"><br></p>
475 <p class=
"p1"><b>splitext
</b></p>
476 <p class=
"p4"><br></p>
477 <p class=
"p1">Split off the extension from a filename or path and return both in an
<b>Array
</b>as [path or filename, extension].
</p>
478 <p class=
"p4"><br></p>
479 <p class=
"p5"><span class=
"s4">"fish.rtf"</span>.splitext;
</p>
480 <p class=
"p8">"Imaginary/Directory/fish.rtf".splitext;
</p>
481 <p class=
"p6"><br></p>
482 <p class=
"p13"><b>Document Support
</b></p>
483 <p class=
"p18"><br></p>
484 <p class=
"p1"><b>newTextWindow(title, makeListener)
</b></p>
485 <p class=
"p4"><br></p>
486 <p class=
"p1">Create a new
<b>Document
</b> with this.
</p>
487 <p class=
"p4"><br></p>
488 <p class=
"p8">"Here is a new Document".newTextWindow;
</p>
489 <p class=
"p6"><br></p>
490 <p class=
"p1"><b>openDocument
</b></p>
491 <p class=
"p4"><br></p>
492 <p class=
"p1">Create a new
<b>Document
</b> from the path corresponding to this. Returns the Document.
</p>
493 <p class=
"p4"><br></p>
495 <p class=
"p5">d =
<span class=
"s4">"Help/Help.html"</span>.openDocument;
</p>
496 <p class=
"p5">d.class;
</p>
498 <p class=
"p6"><br></p>
499 <p class=
"p1"><b>openTextFile(selectionStart, selectionLength)
</b></p>
500 <p class=
"p4"><br></p>
501 <p class=
"p1">Create a new
<b>Document
</b> from the path corresponding to this. The selection arguments will preselect the indicated range in the new window. Returns this.
</p>
502 <p class=
"p4"><br></p>
504 <p class=
"p5">d =
<span class=
"s4">"Help/Help.html"</span>.openTextFile(
20,
210);
</p>
505 <p class=
"p5">d.class;
</p>
507 <p class=
"p6"><br></p>
508 <p class=
"p1"><b>findHelpFile
</b></p>
509 <p class=
"p4"><br></p>
510 <p class=
"p1">Returns the path for the helpfile named this, if it exists, else returns nil.
</p>
511 <p class=
"p4"><br></p>
512 <p class=
"p5"><span class=
"s4">"Document"</span>.findHelpFile;
</p>
513 <p class=
"p5"><span class=
"s4">"foobar"</span>.findHelpFile;
</p>
514 <p class=
"p6"><br></p>
515 <p class=
"p1"><b>openHelpFile
</b></p>
516 <p class=
"p4"><br></p>
517 <p class=
"p1">Performs foundHelpFile(above) on this, and opens the file it if it exists, otherwise opens the main helpfile.
</p>
518 <p class=
"p4"><br></p>
519 <p class=
"p5"><span class=
"s4">"Document"</span>.openHelpFile;
</p>
520 <p class=
"p5"><span class=
"s4">"foobar"</span>.openHelpFile;
</p>
521 <p class=
"p9"><br></p>
522 <p class=
"p1"><b>speak(channel, force)
</b></p>
523 <p class=
"p4"><br></p>
524 <p class=
"p1">Sends string to the speech synthesisier of the OS. (OS X only.) see:
<a href=
"../OSX/Speech.html"><span class=
"s3">Speech
</span></a></p>
525 <p class=
"p19"><br></p>
526 <p class=
"p8">"hi i'm talking with the default voice now, i guess"<span class=
"s2">.speak;
</span></p>
527 <p class=
"p19"><br></p>
528 <p class=
"p9"><br></p>
529 <p class=
"p9"><br></p>
530 <p class=
"p13"><b>Drawing Support
</b></p>
531 <p class=
"p4"><br></p>
532 <p class=
"p1">The following methods must be called within an Window-drawHook or a SCUserView-drawFunc function, and will only be visible once the window or the view is refreshed. Each call to Window-refresh SCUserView-refresh will 'overwrite' all previous drawing by executing the currently defined function.
</p>
533 <p class=
"p4"><br></p>
534 <p class=
"p3"><span class=
"s2">See also:
<a href=
"../GUI/Cocoa-GUI/SCWindow.html"><span class=
"s7">Window
</span></a>,
<a href=
"../GUI/Cocoa-GUI/SCUserView.html"><span class=
"s7">SCUserView
</span></a>,
<a href=
"../GUI/GUI-Tools/Color.html"><span class=
"s7">Color
</span></a>, and
<a href=
"../GUI/Main-GUI/Pen.html"><span class=
"s7">Pen
</span></a>.
</span></p>
535 <p class=
"p4"><br></p>
536 <p class=
"p4"><br></p>
537 <p class=
"p20"><span class=
"s8"><b>Note:
</b> for cross-platform GUIs, use
</span><span class=
"s3">Pen
</span>.stringAtPoint,
<span class=
"s8"> </span><span class=
"s3">Pen
</span>.stringInRect
<span class=
"s8">,
</span><span class=
"s3">Pen
</span>.stringCenteredIn
<span class=
"s8">,
</span><span class=
"s3">Pen
</span>.stringLeftJustIn
<span class=
"s8">,
</span><span class=
"s3">Pen
</span>.stringRightJustIn
<span class=
"s8"> instead.
</span></p>
538 <p class=
"p4"><br></p>
539 <p class=
"p4"><br></p>
540 <p class=
"p1"><b>draw
</b></p>
541 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
542 <p class=
"p1">Draws the String at the current
0@
0 <a href=
"../Geometry/Point.html"><span class=
"s3">Point
</span></a>. If not transformations of the graphics state have taken place this will be the upper left corner of the window. See also
<a href=
"../GUI/Main-GUI/Pen.html"><span class=
"s3">Pen
</span></a>.
</p>
543 <p class=
"p9"><br></p>
545 <p class=
"p5">w =
<span class=
"s3">Window
</span>.new.front;
</p>
546 <p class=
"p5">w.view.background_(
<span class=
"s3">Color
</span>.white);
</p>
547 <p class=
"p5">w.drawHook = {
</p>
548 <p class=
"p8"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>"abababababa\n\n\n"<span class=
"s2">.scramble.draw
</span></p>
550 <p class=
"p5">w.refresh
</p>
552 <p class=
"p9"><br></p>
553 <p class=
"p1"><b>drawAtPoint(point, font, color)
</b></p>
554 <p class=
"p4"><br></p>
555 <p class=
"p1">Draws the String at the given
<a href=
"../Geometry/Point.html"><span class=
"s3">Point
</span></a><b> </b>using the
<a href=
"../GUI/Main-GUI/Font.html"><span class=
"s3">Font
</span></a> and
<a href=
"../GUI/GUI-Tools/Color.html"><span class=
"s3">Color
</span></a> specified.
</p>
556 <p class=
"p4"><br></p>
558 <p class=
"p5">w =
<span class=
"s3">Window
</span>.new.front;
</p>
559 <p class=
"p5">w.view.background_(
<span class=
"s3">Color
</span>.white);
</p>
560 <p class=
"p5">w.drawHook = {
</p>
561 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s4">"abababababa\n\n\n"</span>.scramble.drawAtPoint(
</p>
562 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>100@
100,
<span class=
"Apple-converted-space"> </span></p>
563 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Font
</span>(
<span class=
"s4">"Courier"</span>,
30),
<span class=
"Apple-converted-space"> </span></p>
564 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Color
</span>.blue(
0.3,
0.5))
</p>
566 <p class=
"p5">w.refresh
</p>
568 <p class=
"p9"><br></p>
569 <p class=
"p1"><b>drawInRect(rect, font, color)
</b></p>
570 <p class=
"p4"><br></p>
571 <p class=
"p1">Draws the String into the given
<a href=
"../Geometry/Rect.html"><span class=
"s3">Rect
</span></a> using the
<a href=
"../GUI/Main-GUI/Font.html"><span class=
"s3">Font
</span></a> and
<a href=
"../GUI/GUI-Tools/Color.html"><span class=
"s3">Color
</span></a> specified.
</p>
572 <p class=
"p4"><br></p>
574 <p class=
"p5">w =
<span class=
"s3">Window
</span>.new.front;
</p>
575 <p class=
"p5">r =
<span class=
"s3">Rect
</span>(
100,
100,
100,
100);
</p>
576 <p class=
"p5">w.view.background_(
<span class=
"s3">Color
</span>.white);
</p>
577 <p class=
"p5">w.drawHook = {
</p>
578 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s4">"abababababa\n\n\n"</span>.scramble.drawInRect(
<span class=
"s3">r
</span>,
<span class=
"s3">Font
</span>(
<span class=
"s4">"Courier"</span>,
12),
<span class=
"s3">Color
</span>.blue(
0.3,
0.5));
</p>
579 <p class=
"p5"><span class=
"Apple-tab-span"> </span>Pen.strokeRect(r);
</p>
581 <p class=
"p5">w.refresh
</p>
583 <p class=
"p9"><br></p>
584 <p class=
"p1"><b>drawCenteredIn(rect, font, color)
</b></p>
585 <p class=
"p4"><br></p>
586 <p class=
"p1">Draws the String into the given
<a href=
"../Geometry/Rect.html"><span class=
"s3">Rect
</span></a> using the
<a href=
"../GUI/Main-GUI/Font.html"><span class=
"s3">Font
</span></a> and
<a href=
"../GUI/GUI-Tools/Color.html"><span class=
"s3">Color
</span></a> specified.
</p>
587 <p class=
"p4"><br></p>
589 <p class=
"p5">w =
<span class=
"s3">Window
</span>.new.front;
</p>
590 <p class=
"p5">w.view.background_(
<span class=
"s3">Color
</span>.white);
</p>
591 <p class=
"p5">r =
<span class=
"s3">Rect
</span>(
100,
100,
100,
100);
</p>
592 <p class=
"p5">w.drawHook = {
</p>
593 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s4">"abababababa\n\n\n"</span>.scramble.drawCenteredIn(
</p>
594 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r,
<span class=
"Apple-converted-space"> </span></p>
595 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Font
</span>(
<span class=
"s4">"Courier"</span>,
12),
<span class=
"Apple-converted-space"> </span></p>
596 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Color
</span>.blue(
0.3,
0.5)
</p>
597 <p class=
"p5"><span class=
"Apple-tab-span"> </span>);
</p>
598 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pen
</span>.strokeRect(r);
</p>
600 <p class=
"p5">w.refresh
</p>
602 <p class=
"p9"><br></p>
603 <p class=
"p1"><b>drawLeftJustIn(rect, font, color)
</b></p>
604 <p class=
"p4"><br></p>
605 <p class=
"p1">Draws the String into the given
<a href=
"../Geometry/Rect.html"><span class=
"s3">Rect
</span></a> using the
<a href=
"../GUI/Main-GUI/Font.html"><span class=
"s3">Font
</span></a> and
<a href=
"../GUI/GUI-Tools/Color.html"><span class=
"s3">Color
</span></a> specified.
</p>
606 <p class=
"p4"><br></p>
608 <p class=
"p5">w =
<span class=
"s3">Window
</span>.new.front;
</p>
609 <p class=
"p5">w.view.background_(
<span class=
"s3">Color
</span>.white);
</p>
610 <p class=
"p5">r =
<span class=
"s3">Rect
</span>(
100,
100,
100,
100);
</p>
611 <p class=
"p5">w.drawHook = {
</p>
612 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s4">"abababababa\n\n\n"</span>.scramble.drawLeftJustIn(
</p>
613 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r,
<span class=
"Apple-converted-space"> </span></p>
614 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Font
</span>(
<span class=
"s4">"Courier"</span>,
12),
<span class=
"Apple-converted-space"> </span></p>
615 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Color
</span>.blue(
0.3,
0.5)
</p>
616 <p class=
"p5"><span class=
"Apple-tab-span"> </span>);
</p>
617 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pen
</span>.strokeRect(r);
</p>
619 <p class=
"p5">w.refresh
</p>
621 <p class=
"p9"><br></p>
622 <p class=
"p1"><b>drawRightJustIn(rect, font, color)
</b></p>
623 <p class=
"p4"><br></p>
624 <p class=
"p1">Draws the String into the given
<a href=
"../Geometry/Rect.html"><span class=
"s3">Rect
</span></a> using the
<a href=
"../GUI/Main-GUI/Font.html"><span class=
"s3">Font
</span></a> and
<a href=
"../GUI/GUI-Tools/Color.html"><span class=
"s3">Color
</span></a> specified.
</p>
625 <p class=
"p4"><br></p>
627 <p class=
"p5">w =
<span class=
"s3">Window
</span>.new.front;
</p>
628 <p class=
"p5">w.view.background_(
<span class=
"s3">Color
</span>.white);
</p>
629 <p class=
"p5">r =
<span class=
"s3">Rect
</span>(
100,
100,
100,
100);
</p>
630 <p class=
"p5">w.drawHook = {
</p>
631 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s4">"abababababa\n\n\n"</span>.scramble.drawRightJustIn(
</p>
632 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r,
<span class=
"Apple-converted-space"> </span></p>
633 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Font
</span>(
<span class=
"s4">"Courier"</span>,
<span class=
"s9"> </span>12),
<span class=
"Apple-converted-space"> </span></p>
634 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Color
</span>.blue(
0.3,
0.5)
</p>
635 <p class=
"p5"><span class=
"Apple-tab-span"> </span>);
</p>
636 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pen
</span>.strokeRect(r);
</p>
638 <p class=
"p5">w.refresh
</p>