MapSubString() 是很实用的字符串处理函数,可以替代Replace()PurgeChar()函数。

 

例子:

 

 

ReplaceMap:

 

MAPPING LOAD * INLINE [

 

char replaceChar

 

)

 

(

 

"

 

,

 

/

 

-

 

] (delimiter is ' ')

 

;

 

结果为:

 

LOAD

 

*,

 

MapSubString('ReplaceMap', Orgdata) as ReplacedString

 

;

 

LOAD * INLINE [

 

Orgdata

 

(123)456-7890

 

(111)456,7890

 

"222"456-7890

 

/333/456/7890

 

] (delimiter is ' ')

 

;

 

 

MapSubString() 是很实用的字符串处理函数,可以替代Replace()PurgeChar()函数。

 

例子:

 

 

ReplaceMap:

 

MAPPING LOAD * INLINE [

 

char replaceChar

 

)

 

(

 

"

 

,

 

/

 

-

 

] (delimiter is ' ')

 

;

 

 

TestData:

 

LOAD

 

*,

 

MapSubString('ReplaceMap', Orgdata) as ReplacedString

 

;

 

LOAD * INLINE [

 

Orgdata

 

(123)456-7890

 

(111)456,7890

 

"222"456-7890

 

/333/456/7890

 

] (delimiter is ' ')

 

;

 

结果为:

 

Class2-Blog1

 

 

replace 函数:

 

replace ( string, fromstring, tostring ),如果用Repace函数实现上述功能需要多次调用Replace函数。

 

TestData:

 

LOAD

 

*,

 

replace(replace(replace(replace(replace(replace(Orgdata,'(',''),')',''),'"',''),'/',''),'-',''),',','') as ReplacedString

 

;

 

LOAD * INLINE [

 

Orgdata

 

(123)456-7890

 

(111)456,7890

 

"222"456-7890

 

/333/456/7890

 

] (delimiter is ' ')

 

;

 

 

MapSubString()另外一种使用方法代替PurgeChar()

 

ReplaceMap:

 

MAPPING LOAD * INLINE [

 

char replaceChar

 

)

 

(

 

"

 

,

 

/

 

-

 

] (delimiter is ' ')

 

;

 

 

PurgeChar( s1, s2 )。如果使用PurgeChar()函数,可以这样写:

 

TestData:

 

LOAD

 

*,

 

PurgeChar(Orgdata,'()"/-,') as ReplacedString

 

;

 

LOAD * INLINE [

 

Orgdata

 

(123)456-7890

 

(111)456,7890

 

"222"456-7890

 

/333/456/7890

 

] (delimiter is ' ')

 

;

 

两种方法结果都是:

 

Class2-Blog2