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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

part of string

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
BE
Can I use repclace function or another function to get out of a string a fixed text. Now I work with strLeft and strRight and so on, but is is confusing.

"company wizard LTD googles" should become
"company wizard googles" without LTD.

LTD is a variable, there are a few fixed strings to get out.
 
Well you could as you say use Replace() and replave "LTD" with""

so REPLACE("company wizard LTD googles","LTD","")

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Replace would be good:

TheString=Replace(TheString," LTD "," ")

You would need to ensure that the string to be replaced could not occur elsewhere in the text. Spaces are useful if the string to be replaced never occurs at one end or the other of the text.
 
thanks to both,

little problem remains, if LTD is at the end, it does not work
Replace(string, " LTD ", " ")

I works with Replace(string, " LTD", " ") but I doubt this is the best solution for everything ?
 
1. If I use " SA", then I get a few bugs,
eg. looking for SA in "company san currency"
I got "company n currency"

If I use " SA " previous bug is fixed but al the strings ending with "compnay san currency SA" are not recognized because SA is the end of the string and not recognized as a space ?
 
Go on, have a look at Regular Expressions... [wink]

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
yep, but first I need to learn something in practive from regular expressions they somes so 'çà"àé!>\ complicated. -:)
 
They can look a bit overwhelming, but once you get the basics you start to see how the more daunting patterns are formed. A good place to start is
HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
ok, thanks for your reference.

unlucky I don't get high from this dry, dull msdn info, but far from that it gives some short explanation on regular expressions.

I can also give the answer on my own querstion. A little access trick has solved my problem.

add on your string to search a space "string" & chr(32)
and use the replace function as described by Remou, with a space before and a space after.







 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top