Re: Substring with unknown length (newbie)



"Lene" <lenehell@xxxxxxxxxxx> schreef in bericht
news:1132926414.542477.307870@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> that means I'll have difficulties using the 'copy' function since
> it requires length parameter.
>
> I'm trying to copy or search a string until a certain character match,
> and then null-terminate. something like (pseudo) :
>
> Search string[ i++] until string [ i] = '>';
> string [ i+1] := #0;
>
>

p:=pos(Substring,Mainstring); // eg pos('>','my string is > than yours')
returns 14
if p=0 // no Substring in Mainstring
then decide what you want to do
else s:=copy(Mainstring,1,p); // then reurns the first p chars, eg 'my
string is >'

Tom


.



Relevant Pages

  • Re: Sumproduct in VBA
    ... Thanks a mil Tom and Bob.... ... Yes I have included the string in double quotes. ... SkillLevel is a string, it needs to be in double quotes in the formula: ... empRange As Range) As Variant ...
    (microsoft.public.excel.programming)
  • RE: VBA and SQL dump changing the cell types in other worksheets
    ... Tom thanks very much your suggestion worked. ... Dim cnAssyst_Dev As ADODB.Connection ... Dim strConn As String ... 'Get the start and end dates from Sheet 1 ...
    (microsoft.public.excel.programming)
  • Re: using VLookUp in a VBA program
    ... > I've tried the following as suggested by Tom> ... I would have thought that I am suppose to> include the reference from VBE so that my program can reference the> Analysis Tool, but there are so many packages i am not sure which to> include for the worksheet function. ... >>> Dim WorkSheet As String ...
    (microsoft.public.excel.programming)
  • Re: Sumproduct in VBA
    ... Yes I have included the string in double quotes. ... Tom, I have made the adjustments as per your suggestions. ... SkillLevel is a string, it needs to be in double quotes in the formula: ... empRange As Range) As Variant ...
    (microsoft.public.excel.programming)
  • Re: szPname As String * MAXPNAMELEN (How to declare)
    ... On 2004-10-07, Sakharam Phapale wrote: ... It doesn't include the string variables. ... > Public vDriverVersion As Int16 ... Tom Shelton ...
    (microsoft.public.dotnet.languages.vb)