Rainer
13th October 2010, 11:43
Hi


Is it possible to find in a string a numeric value? Is there any specific 4GL function? :rolleyes:

I want to search a housenumber in a string. Therefore I need to know on which position in a string the numeric expression starts.


Expl:

Source:

tccom010.nama = Street 10a

Target:

Strasse = Street
Hausnummer = 10a


I need to search for 0123456789. Similar to "pos".

Thanks for any input! :)
Regards, Rainer

mark_h
13th October 2010, 16:25
Not that I am aware of, but it should be easy to just write a simple little function.

~Vamsi
13th October 2010, 19:20
Baan provides for regular expressions (its own flavor).

See expr.compile for details. BaanXL uses this function (See Code & Utilities forum).

loveubaan
15th October 2010, 08:44
use following example :
string t.str(20),t.ouput.str(20)
long t.len, i, t.start

t.str = "abcd234 hghk"
/* output required = "234 hbhk"

t.len = len(t.str )
for i = 1 to t.len
if val(t.str(i,1)) <> 0 then
t.start = i
break
else
if t.str(i,1) = "0" then
t.start = i
break
endif
endif

endfor

t.ouput.str = t.str(t.start,t.len-t.start+1)

bdittmar
15th October 2010, 12:10
use following example :
string t.str(20),t.ouput.str(20)
long t.len, i, t.start

t.str = "abcd234 hghk"
/* output required = "234 hbhk"

t.len = len(t.str )
for i = 1 to t.len
if val(t.str(i,1)) <> 0 then
t.start = i
break
else
if t.str(i,1) = "0" then
t.start = i
break
endif
endif

endfor

t.ouput.str = t.str(t.start,t.len-t.start+1)

Hello,
whats about this Adresscode:
(It's an existing Adresscode in Berlin (Germany)!)

Straße des 17. Juni 10a

Conclusion: Never 100 % can be reached !

Regards

croezen
29th December 2010, 17:51
maybe you could start at the end of the string and find the first space?
is the case of "Straße des 17. Juni 10a" you could get "10a"

then again, if you have records with "10 a" this won't work.

Hitesh Shah
3rd January 2011, 19:03
U can get the numeric value position in a string by following code;

long eid, longret, length_res, pos_res
|assume tccom010.nama has value "Street 10a"
string tmp(4)
eid = expr.compile( "tccom010.nama IN ""[0-9]""" )
longret = l.expr( eid )
store.long( longret, tmp )
length_res = load.short( tmp(1;2) ) | length_res contains length of searched field 1
pos_res = load.short( tmp(3;2) ) | pos_res contains 8


But not sure how it helps in ur end goal . U need to check it better for all known conditions.