A
download StringUtils.pas
Language: Delphi
Copyright: (C) 2004,2005 Maguma, GmbH/Srl;
LOC: 32
Project Info
Maguma Open Studio(openstudio)
Server: SourceForge
Type: cvs
...tudio\OpenStudio\src\Units\
   .cvsignore
   dlgCancel.dfm
   dlgCancel.pas
   DosRedirect.pas
   MiscUtils.pas
   Passwords.pas
   PHPCodeElement.pas
   PHPCodeParser.pas
   PHPDocCommentParser.pas
   PHPUtils.pas
   RedirectConsole.pas
   RegExpr.pas
   ServiceControl.pas
   StringUtils.pas
   ToolButtons.pas

{----------------------------------------------------------------------------

The contents of this file are subject to the Maguma Public License Version 
1.0 ("License"); You may not use this file except in compliance with the 
License. You may obtain a copy of the License at http://www.maguma.com/MaPL 
Software distributed under the License is distributed on an "AS IS" basis, 
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 
the specific language governing rights and limitations under the License.

The Original Code is: Maguma Open Studio

The Initial Developer of the Original Code is Maguma, GmbH/Srl

Portions created by Maguma Open Studio are 
Copyright (C) 2004,2005 Maguma, GmbH/Srl;

All Rights Reserved.

Contributors listed in the contributors.txt file included with the 
distribution.

----------------------------------------------------------------------------

$Id: StringUtils.pas,v 1.1 2005/03/09 09:29:28 spooker Exp $

You may retrieve the latest version of this file at the Open Studio home 
page, located at http://sourceforge.net/projects/openstudio/

----------------------------------------------------------------------------}

unit StringUtils;

interface

uses SysUtils;

  function InDelimString(const ToFind: String; Str: String; Delim: Char): Boolean;
  function ExtractFilePathEx(const fname: TFileName): String;

implementation

// Checks whether ToFind is in the String Str which contains values delimited by a Delim char
function InDelimString(const ToFind: String; Str: String; Delim: Char): Boolean;
var
  i: Integer;
  ext: String;
begin
  Result := False;

  while (Length(Str) > 0) do
  begin
    i := Pos(';', Str);
    if i <= 0 then i := Length(Str) + 1;
    ext := copy(Str, 1, i - 1);
    if CompareStr(ext, ToFind) = 0 then
    begin
      Result := True;
      Break;
    end;
    delete(Str, 1, i);
  end;
end;

// Extracts the File Path of a given file, if the file does not have a path CurrentDir is returned
function ExtractFilePathEx(const fname: TFileName): String;
begin
  Result := ExtractFilePath(fname);
  if Length(Result) = 0 then
    Result := GetCurrentDir + '\';
end;

end.

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us