⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 misc.pas

📁 Gestione Cellulari Nokia
💻 PAS
📖 第 1 页 / 共 2 页
字号:
 sNewNumber,res:string;
begin
 res:='';
 for iPos:=0 to length(sNumber)-1 do
   if sNumber[iPos+1] = ',' then
     break
   else
     sNewNumber:=sNewNumber+sNumber[iPos+1];

  res:=sNewNumber;

  result:=res;
end;

function FilterCr(sText:string):String; //Filters carraige returns
var
  iPos:integer;
  sString:String;
begin
  sString:='';
  for iPos:=0 to Length(sText)-1 do
   begin
    if sText[iPos+1] in [#13,#10] then
      sString:=sString+' '
    else
      sString:=sString+sText[iPos+1];
   end;
  Result:=sString;
end;

////Start of PhoneBookDB Code
Function IsRingTone(sFileName:string):Boolean;
var
  iPos:integer;
  fFile:TextFile;
  sLine:string;
  bRes:boolean;
begin
  bRes:=false;
  if Fileexists(sFileName) then
  begin
  assignFile(fFile,sFilename);
  reset(fFile);
  readln(fFile,sLine);
  closefile(fFile);
  iPos:= Pos(':',sLine); //find first Colon
  if iPos>0 then
    begin
      sLine:=copy(sLine,iPos+1,length(sLine));
      iPos:=Pos(':',sLine); //Find Next Colon
      if iPos>0 then
        begin
          sLine:=copy(sLine,iPos+1,length(sLine));
          iPos:=Pos(':',sLine);  //If there are no more colons, then it is a prob. a ringtone file
          if iPos <= 0 then
             bRes:=True;
        end;
    end;
  end;
  Result:=bRes;
end;

Function ReturnInsideStr(Count :Integer; Seperator:Char; TextStr : String) : String;
      Function MidString(Str: String; From, SLen : Integer) : String;
      Var
         S : String;
         Pos : Integer;
         Len : Integer;
      begin

           S:='';
           Pos :=0;

           Len := Length(Str);
           if str <>'' then
           begin
           while (Pos < From) and (Pos < Len) do
                 Begin
                      Pos := Pos+1
                 end;
           while (Pos < Len)  and ((SLen = -1) or (SLen > 0)) do
                 Begin
                      S:= S + Str[Pos+1];
                      Pos := Pos+1;
                      if (SLen <> -1) then
                        SLen := SLen-1;
                 end;
           end;
           MidString:=S;
           {InformationBox('String:= '+S);}
      end;
      Function RightString(Str: String; RightMost : Integer) : String;
      Var
         Len : Integer;
      begin
           Len := Length(Str);
           if str <> '' then
           if (RightMost > Len) then
             RightMost:=Len;
           Rightstring:=MidString(Str,Len-RightMost,-1);
      end;

      Function LeftString(Str : String; LeftMost : Integer) : String;
      Var
         S : String;
         Pos : Integer;
         Len : Integer;
      begin

           S:='';
           Pos :=0;

           Len := Length(Str);
           if str <>'' then
           while (Pos < LeftMost) and (Pos < Len) do
                 Begin
                      {InformationBox('Str := '+Str[Pos]);}
                      S:= S + Str[Pos+1];
                      Pos := Pos+1
                 end;
           LeftString:=S;
      {     InformationBox('String:= '+S);}
      end;


      Function StringPos(Text:String; Key : Char) : Integer;
      Var
         Pos,len : Integer;
      begin
         Pos :=0;
         Len := Length(Text);
         if text <>'' then
         while (Pos < len) do
           begin
                if (Text[Pos+1] = Key) then
                   begin
                        StringPos:=Pos;
                        exit;
                   end;
                Pos := Pos+1;
          end;
         StringPos:= -1;
      end;
    Function LeftTrimString(Text:String) : String;
      Var
         S : String;
      begin
        S := Text;
        if s<>'' then
        while (Length(S) > 0) and (S[1] = #32) do
          Delete(S,1,1);
        LeftTrimString := s;
      end;

      Function RightTrimString(Text:String) : String;
      Var
         len : Integer;
         S : String;
      begin
        S := Text;
        Len := Length(Text);
        if s <>'' then
        while (Len > 0)  and (text[Len] = #32)do
          begin
              Delete(Text,Len,1);
              Len := Len-1;
          end;
        RightTrimString := Text;
      end;

var
    Pos, OurCount  :Integer;
    Text : String;
begin
    Text := TextStr;
    If (Count = 0) Then {' If we want the first string, either all of it or upto the chr$(9)}
       begin
            Pos := StringPos(Text, Seperator);               { See if there is a chr$(9) }
            If (Pos = -1) Then                       { No there is not a chr$(9) }
               ReturnInsideStr := Text           { return whole stribg }
            Else
               ReturnInsideStr := RightTrimString(LeftTrimString(LeftString(Text, Pos)));
               { Return string up to the chr$(9) but not including...}
       end
    Else
      begin
        { We want a "count" sub string..... }
        OurCount := 0;
        while OurCount <> Count do
          begin
            Pos := StringPos(Text, Seperator);        { See if there is a chr$(9) }
            If (Pos = -1) Then                         {' No there is not a chr$(9) }
               begin
                    ReturnInsideStr := '';            {' return nothing, Count not met }
                    Exit;
                end
            Else
                begin
                     {InformationBox('Text Before MidString := ['+Text+'] Chris Crowe');}
                     Text := MidString(Text, Pos+1,-1);            { Remove text up to and including the chr$(9) }
                     {InformationBox('Text After MidString := ['+Text+'] Chris Crowe');}
                     OurCount := OurCount + 1;
                end;
          end;
        {InformationBox('Final Check: ['+Text+']  HELP');}
        Pos := StringPos(Text, Seperator);              { See if there is another chr$(9) }
        If (Pos = -1) Then                      {' No there is not a chr$(9) }
            ReturnInsideStr := Text          {' return whole string }
        Else
            begin
                 {InformationBox('Last Check: ['+Text+'] HELLo');}
                 ReturnInsideStr := RightTrimString(LeftTrimString(LeftString(Text, Pos)));
            end
        End;
End;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -