Results 1 to 5 of 5

Thread: Need help with string manipulation

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2004
    Location
    LA
    Posts
    57

    Question Need help with string manipulation

    Hello All,

    Is there a way to search a string for pattern like hh:mm:ss AM or PM and then extract it if it exists.

    Tahnk you.

  2. #2
    Member
    Join Date
    Jun 2004
    Location
    The Netherlands
    Posts
    37
    I would start with finding the beginning of what you are looking for;

    dim index as integer

    index = string.LastIndexOf(searchstring)

    Then copy what you want into another string;

    newstring = searchstring.substring(index, len(searchstring))

    This would do it, but it's very general, just read the string manipulation help files, then go through the string you're searching bit by bit and copy what you need.

  3. #3
    Fanatic Member
    Join Date
    May 2002
    Posts
    746
    Read up on regular expressions (System.Text.RegularExpressions).

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2004
    Location
    LA
    Posts
    57
    I’m trying to math this pattern 12:00:00 AM

    Code:
    “\A(\d(1[0-2][0-9])): (\d(2[0-5][0-9])): (\d(3[0-5][0-9]))\s AM|PM \Z”
    Can some one tell me what I’m doing wrong



  5. #5
    Lively Member
    Join Date
    Jun 2004
    Posts
    74
    Check out the Like function. Great for pattern matching too.

    HTH

    Hume

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