04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7. Installation<br />

7.8.13.4 Inserting String Characters<br />

CRBasic Example 48.<br />

Inserting String Characters<br />

Objective:<br />

Use MoveBytes() to change "123456789" to "123A56789"<br />

Given:<br />

Try (does not work):<br />

Instead, use:<br />

7.8.13.5 Extracting String Characters<br />

StringVar(7) = "123456789"<br />

"123456789"<br />

StringVar(7,1,4) = "A"<br />

"123A56789"<br />

'Result is<br />

'Result is<br />

StringVar(7) = MoveBytes(Strings(7,1,4),0,"A",0,1) 'Result is<br />

"123A56789"<br />

A specific character in the string can be accessed by using the "dimensional"<br />

syntax; that is, when the third dimension of a string is specified, the third<br />

dimension is the character position.<br />

Table 41. Extracting String Characters<br />

Expression Comments Result<br />

StringVar(3) = "Go Jazz" Loads string into variable StringVar(3) = "Go Jazz"<br />

StringVar(4) = StringVar(3,1,4) Extracts single character StringVar(4) = "J"<br />

7.8.13.6 String Use of ASCII / ANSII Codes<br />

Table 42. Use of ASCII / ANSII Codes Examples<br />

Expression Comments Result<br />

LongVar (7) = ASCII("#") 35<br />

LongVar (8) = ASCII("*") 42<br />

LongVar (9) = "#"<br />

LongVar (1) = "#"-""<br />

Cannot be converted to Long with<br />

NULL<br />

Can be converted to Long without<br />

NULL<br />

NAN<br />

35<br />

239

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!