Hi All,
I have a name field called “Search name” which is composed of 3 substrings, i want to seperate each string and want to store in 3 string variables called Fname, Mname, Lname.
Eg: Searchname=
Valerie Arnessa Wells
Please help me , Its my urgent requirement.
Thanks
Venu
|
When in a hurry I would do something like this:
::
“Search Name” := ‘Valerie Arnessa Wells’;
//“Search Name” := ‘Valerie Wells’; //test
//“Search Name” := ‘Valerie’; //test
“Search Name Orig” := “Search Name”; //…to be able to show result below
Fname := “Search Name”;
i := STRPOS(“Search Name”, ’ ');
IF i > 0 THEN BEGIN
x += 1;
Fname := COPYSTR(“Search Name”, 1, i - 1);
“Search Name” := COPYSTR(“Search Name”, i + 1);
END else
“Search Name” := ‘’; //“Search Name” contains no space at all
//
Mname := “Search Name”;
i := STRPOS(“Search Name”, ’ ');
IF i > 0 THEN BEGIN
x += 1;
Mname := COPYSTR(“Search Name”, 1, i - 1);
“Search Name” := COPYSTR(“Search Name”, i + 1);
END;
//
IF (DELCHR(“Search Name” , ‘<>’) = ‘’) OR (x < 2) THEN BEGIN
//Only one space was found - no middle-name
Lname := Mname;
Mname := ‘’;
END ELSE
Lname := “Search Name”;
//
//Display result…
ERROR(
‘Origin: >%1<\’ +
‘Fname: >%2<’ +
‘Mname: >%3<’ +
‘Lname: >%4<’,
“Search Name Orig”,
Fname,
Mname,
Lname
);
::
“i” and “x” are integer-variables.
If you spend a little more time a nicer solution would contain a function. But this one works…[H]
Hi Venu, for urgent requests you should contact Microsoft and PAY for a support call to be logged.