Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another String Splitting Issue

Status
Not open for further replies.

khdavis

Technical User
Mar 27, 2002
22
US
I posted a string splitting issue earlier today that lbass was able to assist me with (thanks again lbass!) and am hoping someone can help me again with this new one.

Below is an example of the type of string I need to split.
I need to extract the last entry which would be everything after the last set of numbers.

==EXAMPLE OF DATA==
1189792638JAMES SMITHPer Kellie on 9/14 - need notification - will be working with Al Ramos on this.1190301788KELLIE JONESSpoke to the BU and they have put a plan in place to reduce the size of the mailboxes. They are planning to be complete by October 8th.1190992782JAMES SMITHPer Kellie on 9/28, the BU has been doing a great job of getting the mailbox sizes cleaned up.
==END==

In this case I would want to see,

JAMES SMITHPer Kellie on 9/28, the BU has been doing a great job of getting the mailbox sizes cleaned up.

I'm not a programmer, so I'm having major challenges here. Thanks in advance for any help.

I'm using CR10, Oracle database
 
Can you clarify whether those boxes are literally boxes or are you using them to indicate a space? If they are boxes, do you happen to know what chr() they are?

-LB
 
If you can find out what the character value of your box character is, something along the following lines should do the trick. There may be some bits which need tidying up as it's a relatively long piece of untested code.

If the value of the character is say 7, then replace "?" with chr(7) and replace {String} with your appropriate string field.

Booleanvar atstart := false;
Booleanvar onlynumbers := false;
StringVar s := {String};
StringVar c;
StringVar separator := "?";
NumberVar i := 1;
NumberVar laststart := 0;
NumberVar l := length(s);

while i <= l
do (
c := mid(s, i, 1);
if isnumeric(c)
then (
if atstart
then (
onlynumbers := true;
atstart := false;
);
)
else if c = Separator
then (
atstart := true;
if onlynumbers
then (
laststart := i;
);
true
)
else (
atstart := false;
onlynumbers := false;
);
i := i + 1;
);

if LastStart > 0
then right(s, l - laststart)
else ""
 
Thanks to all for the help!

I was able to get the solution by just modifying the formula lbass had provided for a previous earlier issue.

===============
stringvar array x := split({T3450_1.C536870923},chr(03));
x[ubound(x)-1]
===============
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top