substring URGENT!!

tallam

Active Member
hi,

how can i substring the last 5 degits befour the "." in an string
for eg:"123456789.xyzwy" i need to substring "56789"
 
You need to create a Find the Location of a String in a String function, then Subsring the previous five characters before that position.

I'll help you out - I've created the function at another client, I'll boomerang it and send it to you (or upload to this thread). You can use Alex's Free Boomerang tool (if it's still available) and install the function.

The boom will consist of .h, .c and datastructure. USER BEWARE - the download will be your responsibility to validate it functions as to your liking....

I should have it to you by noon, MST

(db)
 
Here you go - C Function for Find the Location of a String in a String (it's not well documented, sorry)...
http://www.existinglight.net/downloads/LocofStringinString.BG1

Basically, put in the string you are looking for, the string you are searching and the integer (location) is returned. You can then subtract the number of characters from the location and do a regular substring.

The function is B550001 and the datastructure is D550001A. If you already have those functions/datastructures - you will have to copy the code (after importing) and recreate using a new set of conventions.

Remember, it's free - and we get what we pay for... But ~ it works at the sites I have used it. There are no warranty, liabilities extended.... (USE AT YOUR OWN RISK)

You can download Boomerang LITE at:
http://www.pastuhov.com.au/cgi-bin/selector.exe?a=browse&p=Boomerang
on the Left panel - you may have to scroll down. My understanding of the Boom LITE is that you can import as often as you desire.

Have some fun!

HTH

(db)

ps - in the event that you do like the function, you can feed my children by paypal'ing to [email protected]
 
Yes, you can find the location of a string within a string, without the custom C function... using the base substring system function... but it's a pain in the arse...

You have to walk through the string, using the substring system function and two variables. Each time you you walk through, you increment the from/to variables by one(or the length of the string you are looking for), then validate what value is brought back by the function. When your '.' is brought back - you know the location of the '.'.... If the '.' was the thousandth character in the string - you would have had to loop a thousand times.

The C function does all that legwork in an 'nth' of the amount of time. If you are fighting with the logic for the manual looping, I can provide that - but it'll have to wait till evening...

(db)
 
hi,
Thanks for ur reply,it would be very helpful if u send me manual looping and will wait
 
List & tallam, let me write a little foreword:

Dear tallam,

Most of your post begins as:

Need Help imm.....!
or ends, as
!!!!!!!!!! or
URGENT!!!!!PLZ or simply
HELP or
!!!!!!HELP ME or now simply
URGENT!!

WHILE
blush.gif
you do not put a piece of your name or favorite nick onto the end of your post (like Daniel, Adrian, Doug, Larry or Zoltán)
blush.gif
further also missing a piece of courtesy from your posts - after your "special" subjects (at least for me), like shortly a TIA or "...will be apreciated", etc.

...and still many of listers reply you, as Daniel was so kind to try to help you.

IMHO
blush.gif
URGENT is to study a bit the Development tools
blush.gif
URGENT is to try to use your mind too

Dear Moderators & Administrators,

Please, remove my post, if you find, that it is not appropriate in this community!
Thanks!

Hi tallam again,

Here are my 2 cents for you.

1st:
As Daniel replied you, you can make your own code in ER for this functionality (also described very well the algorithm too - which is not too hard to figure out yourself)

If this is a repeatedly task, then place your logic into a BSFN.
If it is not targeted only for dot character, then you can create your BSFN as a general "find string in a string" function

2nd:
There is a special and simple solution, if you have always the same number of non-blank characer after the dot character

Supppose:
- max. length of your string is 30
- you have always 6 non-blank char after the dot
Let see the ER code

rtrim(evt_FullString_DL01,' ')
lpad(evt_FullString_DL01,' ',30)
evt_SubString_DL01 = substring(evt_FullString_DL01,18,5)

18 was derived as:
- last position is 29 (based on 0 as first position)
- 6 char after dot: 29 - 6 = 23
- dot char: 23 -1 = 22
- 5 char before dot: 22 - 5 = 17
- 17 pos is the first char before your 5 char, so your 5 char will begin on pos 18.

Regards,

Zoltán
P.S.: everybody's issue is URGENT and requires HELP IMMEDIATELY, not everybody is crying after all on JDEList Forum.
Please, forgive me, if I was too hard.
 
Well said, Zoltan. I have a feeling that tallam is ekben's new screen name
smirk.gif
 
Hi Guys,

I am very sorry for my posts staring with taglines urgent! help me plz! here after i will put it in right manner
and i appreciate all ur help given to me on this forun
 
Hi tallam,

That's OK.
No problem, but please, take our advises.
Be sure, you won't give more help, if you are crying, but...

This community is very helpful, won't discriminate anybody after 1st, 2nd, 3rd, nth posts
...but please, waste some minutes to read to NETIQUETTE sticky post on the very beginning of this board.

Be sure, everybody can understand the other's problem, but...

Read you later...
...and be sure, JDELIst will help you if they can.

Best Regards, Zoltán
 
**************URGENT**************

Please do not help Tallam if you keep on helpling him these basic things like how to use substring and looping to increase the position counter he is never going to learn by himself. Its obvious that he know about the substring function but he is not putting any effort to write it himself. I will not help him untill he shows me a little bit of effort. Like I did this and this but it didnt work.

**************URGENT******************
 
Naveed - WHAT AN ARSE!

I suppose you were never (never) part of the same learning curve that the rest of us were part of? I've asked stupid questions (haven't you?)

Maybe he's slow or ignorant to learn - but (BUT) we can all learn from the answers to the questions. We all (regardless how dumb we are) look for the same answers to the same questions.

If a fix/answer is replied to for something an idiot asks - someone with a brain is going to ask the same question, on a day that their brain farts out on them...

That said - I'll try to provide the code later this evening...

(db)
 
Get the length of the string

Use counter to substring the string by character and stop when it found "." Then substring the string, using the counter - 5.

Ex;

Counter =3D 0
StrLenght =3D length(String)

Do while Counter <=3D StrLenght
Char =3D substring (String, Counter, 1)
If Char =3D=3D "." Then
FiveDigitbeforeDot =3D Substring(String, Counter - 5, 5)
Counter =3D length + 1
Else
Counter =3D Counter + 1
End if
End do
 
Here's the undocumented Find the location of a string in a string (I think this is what you are looking for).

Now - you'll have to take it the extra mile and make it work to your needs. I didn't put in the 'little nice things' that I'd put in for a client (you guys have to figure those for yourselves)...
cool.gif
Feel free to IM me - if the process is frustrating.

----------------------
=======================================================================
SECTION: Address Book-One Line Report [COLUMNAR SECTION] (S1)
=======================================================================
OBJECT: SECTION
EVENT: Do Section
-----------------------------------------------------------------------
evt_Begin_Substring
evt_End_Substring
evt_Result
evt_SearchString
evt_String2Search
evt_LengthOfString
0001 VA evt_Begin_Substring = "0"
0002 VA evt_End_Substring = "1"
0003 VA evt_Result = ""
0004 VA evt_String2Search = ltrim(rtrim([BC Name - Alpha (F0101)],' '),' ' )
0005 VA evt_LengthOfString = length([VA evt_String2Search])
0006 VA evt_SearchString = "C"
0007 VA evt_Begin_Substring = "0"
0008 //
0009 //
0010 //
0011 VA evt_Result = substr([VA evt_String2Search],[VA evt_Begin_Substring],[VA evt_End_Substring])
0012 While VA evt_Begin_Substring is less than or equal to VA evt_LengthOfString
And VA evt_Result is not equal to "C"
0013 VA evt_Begin_Substring = [VA evt_Begin_Substring]+1
0014 VA evt_End_Substring = "1"
0015 VA evt_Result = substr([VA evt_String2Search],[VA evt_Begin_Substring],[VA evt_End_Substring])
0016 End While
0017 //
0018 If VA evt_Begin_Substring is less than or equal to VA evt_LengthOfString
0019 RV Interest Share = [VA evt_Begin_Substring]+1
0020 End If
0021 //
0022 //
0023 //

Thursday April 28, 2005 20:04
 
Calling me name DBohner, Did is I said he asked a stupid question ?, I just said show me an effort you made before you ask anybody to help on simple thing like how to use a substring function. I know nobody is born a E1 developer.

Read my previous post again please.
 
Hi Tallam,

[ QUOTE ]
can't we do this using jde string functions

[/ QUOTE ]

Yes, you can.
The Finds a char position in a string function in the B7500150 source modul (Find a Char position in a String - China
cool.gif
) will does exactly, what you need.

Are Daniel and me "EARLY ENOUGH"
wink.gif


Bonus Tip for the future:
Use P98621 Business Function Search screen to explore already existing BSFNs, which do the job, what you need - of course, prior to post onto the Forum
smile.gif


Hope, the mentioned BSFN will solve your issue, without further effort.

Regards,

Zoltán
 
I'll reply to Naveed off-list... and try to keep some of the laundry clean.

Zoltan - I was unaware of the function, thanks!

(db)
 
Hi Daniel,

[ QUOTE ]
Zoltan - I was unaware of the function, thanks!


[/ QUOTE ]

Never mind.

I'm sure, your .c solution was more shorter, efficient and sophisticated
wink.gif


By the way, just one year ago I also made my "Find String in String" type NER BSFN
grin.gif

OK, that BSFN has some more special feature too, because its job was a bit more special.

Regards,

Zoltán
 
[ QUOTE ]
Bonus Tip for the future: Use P98621 Business Function Search screen to explore already existing BSFNs, which do the job, what you need - of course, prior to post onto the Forum

[/ QUOTE ]

OR use P98652 Business Function Search and Edit, to see two more columns: System (code) and Source Language (C/NER).

Thank you Zoldy, good to see you active (again)
cool.gif
 
Hi Ady,

Thanks to let me know about P98652.

Previously, while P9860 existed on XE, I checked, which Form/Application is the BSFN Search and I tried to start it on B8.9, where P9860 was already finally retired. That APPL was P98621 and it exists on B8.9 too.

I suppose, won't be a hard job to modify P98621 to show extra columns, neither for you nor for many of us
tongue.gif


I just checked, that P98652 already exists on XE too, so there is no need to modify P98621
cool.gif


Best regards,

Zoltán
 
Back
Top