Results 1 to 4 of 4

Thread: String seperation with period

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    I have a string...

    NewString(0) = "File1.txt"

    I need to seperate it to

    "file1"

    But I dont need it stored ..
    Just need to code so the
    computer sees it without
    storing it..

    How can I do that?

    Something like this:

    If BeforePeriod(String1(0)) = "Text1" then
    end if

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Code:
        Dim s As String
        s = "file1.txt"
        Debug.Print Strings.Left(s, InStr(1, s, ".") - 1)
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub Command1_Click()
    
        NewString(0) = "File1.txt"
        
        If Left(NewString(0), 5) = "File1" Then
          MsgBox "Do Whatever"
        End If
    
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Code:
    Dim intPeriodPos As Integer
    Dim strTextBefPer As String
    
    intPeriodPos = Instr(NewString(0), ".")
    strTextBefPer = Left$(NewString(0), intPeriodPos - 1)
    If strTextBefPer = "whatever" Then ...
    "It's cold gin time again ..."

    Check out my website here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width