參考手冊

DTW_TRANSLATE


AIX HP-UX Linux OS/2 OS/390 OS/400 PTX SUN Win NT
X X X X X X X X X

目的

傳回字串,其中每一個字元都轉換成另一個字元或維持不變。

格式

@DTW_TRANSLATE(stringIn, tableO, tableI, default, stringOut)

@DTW_TRANSLATE(stringIn, tableO, tableI, stringOut)

@DTW_TRANSLATE(stringIn, tableO, stringOut)

@DTW_TRANSLATE(stringIn, stringOut)

@DTW_rTRANSLATE(stringIn, tableO, tableI, default)

@DTW_rTRANSLATE(stringIn, tableO, tableI)

@DTW_rTRANSLATE(stringIn, tableO)

@DTW_rTRANSLATE(stringIn)

參數

表 102. DTW_TRANSLATE 參數
資料類型 參數 使用 說明
字串 stringIn IN 一個變數或文字字串。
字串 tableO IN 使用作為轉換表格的變數或文字字串。請使用空值 ("") 來指定 tableIdefault; 否則這個參數將是可選用的。
字串 tableI IN 一個將在 stringIn 中被搜尋的變數或文字字串。請使用空值 ("") 來指定 default; 否則這個參數將是可選用的。
字串 default IN 所使用的預設字元。 預設值是空白。
字串 stringOut OUT 一個包含 stringIn 轉換結果的變數。

回覆碼

表 103. DTW_TRANSLATE 回覆碼
回覆碼 說明
-1001 伺服器無法處理 Net.Data 的配置記憶體要求。
1001 輸入參數包含 NULL 值。
1003 函數呼叫上傳遞的參數數目不正確。
1005 函數呼叫上傳遞的參數必須是字串變數,但卻是不同的變數類型。
1006 文字字串傳遞給函數呼叫中的參數, 但此參數必須是輸出參數。
1007 參數包含的值無效。

用法注意事項

  1. 如果 tableItableOdefault 字元不在參數列示中, 則將會把 stringIn 轉換為大寫。
  2. 如果 tableItableO 都在列示中, 則將會搜尋 tableI 中輸入字串的每一個字元, 並將其轉換為在 tableO 中的相符字元。 如果有一個 tableI 中的字元, 在 tableO 沒有對應的字元,則會使用 default 字元來代替。

範例

範例 1

@DTW_TRANSLATE("abbc", result)

範例 2

@DTW_TRANSLATE("abbc", "R", "bc", result)

範例 3

@DTW_rTRANSLATE("abcdef", "12", "abcd", ".")

範例 4

@DTW_rTRANSLATE("abbc", "", "", "")


[ 頁面頂端 | 前一頁 | 下一頁 | 目錄 | 索引 ]