Re: Split Function and Week Numbers

From: Brian (brian_at_nrwp.co.uk)
Date: 04/16/04


Date: Fri, 16 Apr 2004 15:09:43 +0100

Thanks Tim that did the trick
Brian

> > I know I can use $incoming= split(" ", "$message");
> > and then use $incoming[0] and $incoming[1] to get
> > the first two strings, but how would I get the rest in one
> > string? The last could be any length?
>
> First you ltrim on the string, so there are no leading spaces.
> Next you use strpos to determine the position of the first space.
> With substr 0,pos you get the first word.
> With substr pos+1,strlen($word) you get the rest of the string (=word2).
>
> Now do the same on word2 to find the 2nd word.
> The remainder of that string, is the last part :)



Relevant Pages

  • Re: Selecting street name from address field
    ... the simplest way is to use InStr() to find the ... first space, and Midto return the remainder of the string, e.g. ...
    (microsoft.public.access.gettingstarted)
  • RE: Duplicates in excel that arent 100% DUPLICATES ...
    ... The best way is to use two new auxilary columns. ... for the first space and put the data to the left of the space (the street ... Mid works the same as left put extracts the middle of a string. ... Westbourne" from "111 Westbourne Terr. ...
    (microsoft.public.excel.misc)
  • Re: Working with strings
    ... you have four separate items of ... As for chopping up this string, if you really have to, I would use the ... ' Valstops at the first space, so it will just get the ... ' space char if there is one ...
    (microsoft.public.access.modulesdaovba)
  • Re: Need help on Excel formula to find an occurrence and display n
    ... BACKWARDS left to the first occurrence of "0 " and then return from ... But I guess you are doing that by finding the first space. ... Actually the string contains a space at the end so with that space it ... All lines seem to end in an extra space. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Need help on Excel formula to find an occurrence and display n
    ... BACKWARDS left to the first occurrence of "0 " and then return from ... But I guess you are doing that by finding the first space. ... Actually the string contains a space at the end so with that space it ... Most of the strings will have a trailing space at the end. ...
    (microsoft.public.excel.worksheet.functions)