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: VERY simple question about "?"
    ... don't see the equivalence between a string delimiter, or a character that signals the beginning of a symbol, and a symbol that is actually productive of something. ... Part of my difficulty understanding you is probably caused by the fact that you seem to try to tackle problems of computer languages with tools from a complete different domain. ... "Tom" - my name can also be called, but when one does so IT doesn't spring into action at all. ...
    (comp.lang.ruby)
  • 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)