使用Scan From String、Format into String、Spreadsheet String to Array、Array to Spreadsheet String 等VI都有接角Format String,可以依照輸入的Format格式做客製化更改。這篇介紹如何使用Format String和其範例。

image

因為Format的功能眾多,就以列表展示Format String的類別和應用範例:

image

image

image

以上為圖片檔,因為本來使用文字檔,但是讀者反映看不到文字,所以特地加上圖片檔。

以下文字檔為全表,方便讀者複製內文,內文和上面圖表一模一樣:

Syntax Element

說明

使用方法字串範例

範例

輸入

輸出

s

基本字元,前加數字代表限制的字元數量

%3s

image

image

f

浮點數,前加數字代表限制的字元數量

%2.3f

image

image

d

整數,前加數字代表限制的字元數量

%3d

image

image

$

改變順序(Order)

%2$s %1$s

image

image

+

顯示其數直正負(+-)符號

%+d

image

image

e

工程顯示

%.3e

image

image

^

工程顯示,指數顯示為3倍數

%^.3e

image

image

文字中不包括

%[^,],%s

image

image

^;]%s

image

image

%[^0-9]

image

image

[ ]

數字字元

%[0-9]

image

image

英文字元

(大小寫有區隔)

%[0-9]%[a-z]

image

image

轉換代碼

x,十六進位

%02x

12

0C

o,八進位

%06o

12

000014

b,二進位

%b

12

1100

相對時間t

輸入為秒數

%.2t

image

image

%<Hours:%H Minutes:%M Seconds:%S>t

image

image

絕對時間T

輸入的時間格式必須正確

%<%.3X %x>T

00:00:00.000 AM
1/1/2001

12:00:00.000 AM 01/01/2001

%<%Y.%m.%d>T

00:00:00.000 AM
1/1/2001

2001.01.01

 

如果覺得文章有幫助,請不要吝嗇按下側邊的廣告唷~ 謝謝~

 

學習相關LabVIEW文章:

進階程式學習

基礎程式學習

專題學習_LVOOP

專題學習_動態載入

程式分享相關LabVIEW文章:

基礎程式分享

進階程式分享

股票程式分享

考取LabVIEW證照相關:

CLAD

CLD

CLA準備CLA考題分析

arrow
arrow

    安伯伯 發表在 痞客邦 留言(0) 人氣()