Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using STREXTRACT
Message
De
07/10/2018 13:51:30
 
 
À
07/10/2018 13:17:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01662486
Message ID:
01662495
Vues:
44
>>Wow! you're so right, Thomas. Silly me.
>>
>>>Don't want to be RATting on vfp capabilities, but going AT it from left and right might be KISS on this specific UC
>>>
>>>LastIndexOf in other script languages feel overblown compared to vfp conciseness
>>>
>>>;-)

Based on Above This may perhaps work
SUBSTR(Completestring,AT_C('(',Completestring)+1,RATC(')',Completestring)-AT_C('(',Completestring)-1)
>>>>>Hi,
>>>>>Please consider these two cases
>>>>>
>>>>>A=F1 (Plan 99 \Old Plan 100\)472 676 w
>>>>>A=F1 (Plan 99 \(Old Plan 100\))472 676 w
>>>>>
>>>>>
>>>>>I need to Extract the Text Between the two Brackets i.e "(" and ")"
>>>>>
>>>>>If I use STREXTRACT(A,'(',')'), for the first Case I get " Plan 99 \Old Plan 100\", which is correct as per my requirement.
>>>>>
>>>>>But I get "Plan 99 \(Old Plan 100\" for my second case while It need "Plan 99 \(Old Plan 100\)".
>>>>>
>>>>>I Need to extract the Text Between Two Extreme Brackets. How to do this in both the above situation.
>>>>>
>>>>>Thanks
>>>>
>>>>Harsh,
>>>>
>>>>A generalized function that expands on STREXTRACT():
>>>>
>>>>
>>>>? OuterStrExtract("A=F1 (Plan 99 \Old Plan 100\)472 676 w", "(", ")")
>>>>? OuterStrExtract("A=F1 (Plan 99 \(Old Plan 100\))472 676 ", "(", ")")
>>>>
>>>>FUNCTION OuterStrExtract (Searched AS String, BeginDelimiter AS String, EndDelimiter AS String)
>>>>
>>>>	LOCAL ARRAY Segments(1)
>>>>	LOCAL SegIndex AS Integer
>>>>	LOCAL RebuildInnerStr AS String
>>>>	LOCAL OuterString AS String
>>>>
>>>>	m.OuterString = ""
>>>>	m.RebuildInnerStr = ""
>>>>
>>>>	FOR m.SegIndex = 1 TO ALINES(m.Segments, STREXTRACT(m.Searched, m.BeginDelimiter, "", 1), 0, m.EndDelimiter) - 1
>>>>		m.OuterString = m.OuterString + m.RebuildInnerStr + m.Segments(m.SegIndex)
>>>>		m.RebuildInnerStr = m.EndDelimiter
>>>>	ENDFOR
>>>>
>>>>	RETURN m.OuterString
>>>>
>>>>ENDFUNC
>>>>
>
>
>Based on What Thomas Sir commented, can there be some simpler Solution to my requirement. ?
Harsh
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform