vineetu1
10th December 2004, 09:26
A typical item code (finished goods) in our system is
eg. 511 (J) 01 059

I want to incorporate a seperate search string field. This search string will be a truncated form of the item code i.e. 511J01059

Basically I want to write a function which converts
"511 (J) 01 059" to -> "511J01059".

I was not able to traceout any inbuilt function which can remove any specific character from a string.

How should I go about it...
:confused:

kbartelds
10th December 2004, 11:57
You can use the pos function to determine the characters you are looking for, let's say it results in x and y. Then use concatenate function to eliminate the unwanted chars.
item = item(1;x-1) & item(x+1)
item = item(1;y-1) & item(y+1)

Regards,
Klaas

NyarlaToTep
10th December 2004, 16:43
You can use string.scan function:

item.old = "511(J)12345"
string.scan(item.old, "%s(J)%s", item1,item2)
item.new = item1&item2

Francesco
10th December 2004, 20:02
You can use string.scan function:

item.old = "511(J)12345"
string.scan(item.old, "%s(J)%s", item1,item2)
item.new = item1&item2

but it would be:

item.old = "511(J)12345"
string.scan(item.old, "%s(%s)%s", item.1,item2,item3)
Item.new = item.1 & item.2 & item.3