|
-
May 26th, 2008, 02:39 AM
#1
Thread Starter
Lively Member
[RESOLVED] basic string help :(
Ok, so i have done this:
Text1.Selstart = Instr(Text1, "http://img.")
This begins the start of the selection, however there isnt a Selend, only a Sellength!
I need a way (because the length will always be random) to find the string ".jpg" and end the selection there.
Its properly really easy but im finding this really hard
thanks
-
May 26th, 2008, 02:48 AM
#2
Re: basic string help :(
Truncate the trailing part first. Sellength would then be length of this string less length of leading characters you will also truncate.
-
May 26th, 2008, 02:49 AM
#3
Thread Starter
Lively Member
Re: basic string help :(
Could you give me an example :$ im real bad with this string stuff, it really messes with my mind
-
May 26th, 2008, 02:51 AM
#4
PowerPoster
Re: basic string help :(
something like this maybe:
Code:
Dim val As Integer
Text1.SelStart = 0
pos = InStr(Text1.Text, ".jpg")
val = Len(Mid(Text1.Text, 1, pos - 1))
Text1.SelLength = val
-
May 26th, 2008, 02:59 AM
#5
Re: basic string help :(
My contribution, something like:
Code:
Private Const SEARCHFOR As String = "http://img."
Private Sub Command1_Click()
Dim intSelStart As Integer
Dim intSelEnd As Integer
Dim intSelLength As Integer
Dim intSLen As Integer
intSLen = Len(SEARCHFOR)
intSelStart = InStr(Text1.Text, SEARCHFOR)
intSelEnd = InStr(intSelStart + intSLen - 1, Text1.Text, ".jpg")
Text1.SelStart = intSelStart - 1
Text1.SelLength = intSelEnd + 3 - intSelStart + 1
End Sub
-
May 26th, 2008, 03:37 AM
#6
Thread Starter
Lively Member
Re: [RESOLVED] basic string help :(
thanks. that last one did it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|