QUOTE
I want to split that text line and save paricular word from text line in variable. What is the solution for this??????
Eg of text line : Dubai,Cargo Release,(ML)(Maersk Line (Dubai))
from above textline I want "Dubai" word that is present in brackets.
In the code below
temp is a string containing the line of text and
find is the text you are looking for. The
posFound variable holds the position of the start of
find within
temp. E.g: if temp = "here you go" and find = "yo" posFound will become 6.
You do know that Dubai is in brackets, you also know that Dubai will be found in a position which is larger then the position of the string ")(". You can make a temporary string of whatever is present after the ")(" and in the temporary string search for "(". Otherwise, maybe there's some string function that will find a certain substring that will accept a starting point to look at...
This is VB6 code:
CODE
# posFound = InStr(UCase(LTrim(temp)), UCase(find))
# If posFound > 0 Then
# 'If you land here you have found the string and you know
# 'what position it starts in.
# 'Look at e.g: <a linkindex="162" href="http://www.example-code.com/vb/string.asp" target="_blank">http://www.example-code.com/vb/string.asp</a>
# 'and especially at "string length" and "extract substring"
The
UCase stuff makes whatever you feed it with become ALL CAPITALS which comes in handy if you don't know if the string you are searching through is CAPITALS or not.
The
LTrim thingy makes spaces (blanks) in the beginning of the string go away.
Just a hint
/Jens
This post has been edited by jens: 13 Aug, 2008 - 01:38 AM