2012年11月21日 星期三

String to Array,以分號當分隔

目的:以Automatic Formatting當字串格式,用分號(;)當分隔,將字串分隔並使用Array方式儲存。

實現方法:








Help:

delimiter----------------分隔
format string ------------字串格式
spreadsheet string ------電子表單(原始字串)
array type --------------初始陣列



format string (字串格式) 說明如下:

Type Argument(s) Format String Resulting String Comments
Automatic Formatting (%g) 12.00 %#g 12 If you specify #, LabVIEW removes trailing zeros. If you specify g, LabVIEW chooses scientific notation or floating-point notation based on the number to format.
12000000 %#g 1.2E+6
Decimal (%d) 12.67 score= %.0f%% score= 13% When you specify %f, LabVIEW rounds the argument. Use %% to format a single %. Use .0 to remove decimal.
Floating-Point (%f) 12.67 Temp: %5.1f Temp: 12.7 The 5 in the Format String section specifies a width of 5, and the 1 specifies the number of digits to the right of the decimal, or precision.
12.67 N %5.3f 12.670 N Units are valid only if you use the Format Into String or Scan From String functions. These are examples of physical quantity input. The second example shows how you can convert from one unit to another. The question mark indicates when the unit in the format specifier is in conflict with the input unit.
12.67 N %5.3{mN}f 12670.000 mN
12.67 N %5.3{kg}f 12.670 ?kg
Scientific Notation (%e) 12.67 %.3e 1.267E+1 Add ^ to change to engineering notation where the exponent is always a multiple of three.
12.67 %^.3e 12.670E+0
SI Notation (%p) 12000000 %.2p 12.00M A value of .2 specifies that you want a precision of 2 digits in the resulting string. A value of _2 specifies that you want two significant digits in the resulting string. %p adds the SI prefixes.
12000000 %_2p 12M
Hexadecimal (%x) 12 %02x 0C A – indicates that you want the resulting string left justified. A 0 indicates that you want the resulting string padded with zeros. The number specifies the width of the resulting string. In other words, a value of –n pads the resulting string with spaces to the n width. b is base 2, o is base 8, and x is base 16.
Octal (%o) 12 %06o 000014
Binary (%b) 12 %b 1100
Relative Time (%t) 91.80 %.2t 01:31.80 LabVIEW formats elapsed time in terms of complete weeks (%W), days (%D), hours (%H), minutes (%M), seconds (%S), and fractions of seconds (%u). Refer to the Format Codes for the Time Format String for more time format codes.
91.8 %<Hours:%H Minutes:%M Seconds:%S>t Hours:00 Minutes:01 Seconds:31
Absolute Time (%T) 00:00:00.000 AM
1/1/2001
(Universal Time)
%<%.3X %x>T 12:00:00.000 AM 01/01/2001 %T specifies absolute time. Any information you include with the < and > brackets indicates how you want to format the absolute time. This format, including the punctuation, changes based on the regional settings of the computer. The time changes based on the configured time zone for the computer. Refer to the Format Codes for the Time Format String for more time format codes.
00:00:00.000 AM
1/1/2001
(Universal Time)
%<%Y.%m.%d>T 2001.01.01
00:00:00.000 AM
1/1/2001
(Universal Time)
%^<%.3X %x>T 06:00:00.000 AM 12/31/2000 Add ^ to format the time in Universal Time.
String (%s) Smith John Name: %s, %s. Name: Smith, John. Strings are valid only if you use the Format Into String function. In the second example, the format string specifies to use at most six characters from the string Hello, World then pad with spaces so the total string length is equal to 10.
Hello, World String: %10.6s String:   Hello,
Variable Order (%$) Smith John %2$s %1$s John Smith In this example, Smith is the first variable and John is the second variable. If you use the $ syntax element in the format string for a particular variable, subsequent syntax elements that are not preceded by a $ syntax element apply to the next variable. If you use the $ syntax element for a variable, use the $ syntax element for any other variables in the string to improve readability.

沒有留言:

張貼留言