pos('-',s) 返回值为s字符串中‘-’的位置
如果不包含‘-’,则返回小于0的数,余下的你看着办吧

解决方案 »

  1.   

    在单元Httpapp中,有现成的方法可用:
    procedure ExtractHTTPFields(Separators, WhiteSpace: TSysCharSet
    ; Content: PChar; Strings: TStrings; StripQuotes:Boolean=False);用法是ExtractHTTPFields(['-],[],‘**-***’,ss);其中ss是TStringList.Parses a multi-valued string into its constituent fields.
    ExtractHTTPFields is a general utility to parse multi-valued HTTP header strings into separate substrings. Separators is a set of characters that are used to separate individual values within the multi-valued string.WhiteSpace is a set of characters that are to be ignored when parsing the string.Content is the multi-valued string to be parsed.Strings is the TStrings object that receives the individual values that are parsed from Content. StripQuotes determines whether the surrounding quotes are removed from the resulting items. When StripQuotes is True, surrounding quotes are removed before substrings are added to Strings.
      

  2.   

    先pos取位置,再用copy来取子串
    例**-***如果取后面的***的话
    var i:integer;
        s,s1:string;
    begin
    s:='**-***'    
    i:=pos('-',s);
    s1:=copy(s,i+1,length(s))
    showmessage(s1);
    end;