© 7may02/[email protected]
local ä,ï,ÿ
""
→
ÿ
for ä,1,dim(s)
ord(mid(s,ä,1))
→
ï
ÿ&char(when(ï
≥
97 and ï
≤
122 or ï
≥
224 and ï
≤
246 or ï
≥
248 and ï
≤
256,ï-32,ï))
→
ÿ
endfor
return ÿ
EndFunc
Some examples:
caseu("abc")
returns
"ABC"
casel("ABC")
returns
"abc"
caseu("a+b=C")
returns
"A+B=C"
Both functions work by getting the code of each character in the string, with ord(), then adjusting the
code by 32 only if the character has a lower-case equivalent, as determined by its code. Note that the
and operator has higher priority than or, so no parentheses are needed.
The execution time in seconds can be estimated as 0.097c + 0.081, where c is the number of
characters in the string. For example, a 10-character string converts in about 1.05 seconds.
[8.7] Replacement for mid() and right() functions use position instead of count
The built-in mid() function has the syntax mid(string, start [,count]) when used with a string argument.
count characters are returned from string, beginning at character start. Sometimes it is more
convenient to extract characters from a start position to an end position, instead of a number of
characters. It is trivial to find
count = end - start + 1
but it may be useful to define it as a function:
mid1(s,n,m)
Func
©(s,n,m) return elements from n to m of s
©7nov01/[email protected]
mid(s,n,m-n+1)
EndFunc
For example,
mid1("abcdefghi",3,7)
returns "cdefg".
The built-in mid() function also operates on lists, and so does mid1(), since it calls mid(). For this
reason, the default behavior of mid1() is the same as mid().
We can also write a similar replacement function for right() which uses a position for the argument,
instead of the number of elements:
right1(s,p)
Func
©(s,p) return right elements from p of s
8 - 4
Summary of Contents for TI-92+
Page 52: ...Component side of PCB GraphLink I O connector detail 1 41...
Page 53: ...LCD connector detail PCB switch side 1 42...
Page 54: ...Key pad sheet contact side Key pad sheet key side 1 43...
Page 55: ...Key cap detail 1 44...
Page 57: ...Component side of PCB with shield removed A detail view of the intergrated circuits 1 46...
Page 410: ...void extensionroutine2 void Credit to Bhuvanesh Bhatt 10 4...