Section 7. Installation
7.9.19.6 String Use of ASCII / ANSII Codes
Table 50.
Use of ASCII / ANSII Codes Examples
Expression
Comments
Result
LongVar (7) = ASCII("#")
35
LongVar (8) = ASCII("*")
42
LongVar (9) = "#"
Cannot be converted to Long with
NULL
NAN
LongVar (1) = "#"-""
Can be converted to Long without
NULL
35
7.9.19.7 Formatting Strings
Table 51.
Formatting Strings Examples
Expression
Result
Str(1)=123e4
Str(2)=FormatFloat(123e4,"%12.2f")
Str(3)=FormatFloat(Values(2)," The battery is %.3g Volts ")
Str(4)=Strings(3,1,InStr(1,Strings(3),"The battery is ",4))
Str(5)=Strings(3,1,InStr(1,Strings(3),"is ",2) + 3)
1230000
1230000.00
“The battery is 12.4 Volts”
12.4 Volts
12.4 Volts
Str(6)=Replace("The battery is 12.4 Volts"," is "," = ")
Str(7)=LTrim("The battery is 12.4 Volts")
Str(8)=RTrim("The battery is 12.4 Volts")
Str(9)=Trim("The battery is 12.4 Volts")
Str(10)=UpperCase("The battery is 12.4 Volts")
The battery = 12.4 Volts
The battery is 12.4 Volts
The battery is 12.4 Volts
The battery is 12.4 Volts
THE BATTERY IS 12.4 VOLTS
Str(12)=Left("The battery is 12.4 Volts",5)
Str(13)=Right("The battery is 12.4 Volts",7)
The b
Volts
CRBasic Example 60.
Formatting Strings
'This program example demonstrates the formatting of string variables. To run the
'demonstration, send this program to the CR1000. String formatting will occur
'automatically.
'Objective:
'Extract "12.4 Volts" from the string "The battery is 12.4 Volts"
Public
StringVar
As String
BeginProg
'Note line continuation character _
StringVar() =
Mid
("The battery is 12.4 Volts", _
InStr
(1,"The battery is 12.4 Volts"," is ",2)+3,
Len
("The battery is 12.4 Volts"))
EndProg
287
Содержание CR1000
Страница 2: ......
Страница 4: ......
Страница 6: ......
Страница 32: ......
Страница 36: ......
Страница 38: ......
Страница 40: ......
Страница 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Страница 96: ......
Страница 98: ...98 ...
Страница 302: ......
Страница 350: ...Section 8 Operation Figure 91 Pulse Sensor Output Signal Types Figure 92 Switch Closure Pulse Sensor 350 ...
Страница 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Страница 454: ...Section 8 Operation 8 8 1 Data Display Figure 116 Displaying Data with the Keyboard Display 454 ...
Страница 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Страница 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Страница 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Страница 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Страница 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Страница 478: ......
Страница 506: ......
Страница 536: ......
Страница 636: ......
Страница 642: ......
Страница 644: ......
Страница 676: ......
Страница 677: ......