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

📄 _ststring.pas

📁 条码控件: 一维条码控件 二维条码控件 PDF417Barcode MaxiCodeBarcode
💻 PAS
📖 第 1 页 / 共 3 页
字号:

function TStString.OctalW(W: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.OctalWW(W);
end;

function TStString.OctalL(L: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.OctalLW(LongInt(L));
end;

function TStString.Pad(const S: WideString; Len: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.PadW(S, Cardinal(Len));
end;

function TStString.PadCh(const S, C: WideString; Len: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.PadChW(S, C[1], Cardinal(Len));
end;

function TStString.Real2Str(R: Double; Width, Places: Byte): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.Real2StrW(R, Width, ShortInt(Places));
end;

function TStString.RepeatString(const S: WideString;
  var Repetitions: Integer; MaxLen: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.RepeatStringW(S, Cardinal(Repetitions), Cardinal(MaxLen));
end;

function TStString.ReplaceWord(const S, WordDelims, OldWord,
  NewWord: WideString; N: Integer; var Replacements: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.ReplaceWordW(S, WordDelims, OldWord, NewWord, Cardinal(N), Cardinal(Replacements));
end;

function TStString.ReplaceWordAll(const S, WordDelims, OldWord,
  NewWord: WideString; var Replacements: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.ReplaceWordAllW(S, WordDelims, OldWord, NewWord, Cardinal(Replacements));
end;

function TStString.ReplaceString(const S, OldString, NewString: WideString;
  N: Integer; var Replacements: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.ReplaceStringW(S, OldString, NewString, Cardinal(N), Cardinal(Replacements));
end;

function TStString.ReplaceStringAll(const S, OldString,
  NewString: WideString; var Replacements: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.ReplaceStringAllW(S, OldString, NewString, Cardinal(Replacements));
end;

function TStString.RightTrimChars(const S, Chars: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.RightTrimCharsW(S, Chars);
end;

function TStString.Scramble(const S, Key: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.ScrambleW(S, Key);
end;

function TStString.Str2Ext(const S: WideString;
  var R: OleVariant): WordBool;
var
  R1 : Extended;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  R1 := R;
  Result := StStrW.Str2ExtW(S, R1);
  R := R1;
end;

function TStString.Str2Int16(const S: WideString;
  var I: Smallint): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.Str2Int16W(S, I);
end;

function TStString.Str2Long(const S: WideString; var I: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.Str2LongW(S, LongInt(I));
end;

function TStString.Str2Real(const S: WideString; var R: Double): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.Str2RealW(S, R);
end;

function TStString.Str2Word(const S: WideString; var W: Integer): WordBool;
var
  W1 : Word;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.Str2WordW(S, W1);
  W := W1;
end;

function TStString.StrChDelete(const S: WideString;
  Pos: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.StrChDeleteW(S, Cardinal(Pos));
end;

function TStString.StrChInsert(const S, C: WideString;
  Pos: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.StrChInsertW(S, C[1], Cardinal(Pos));
end;

function TStString.StrChPos(const P, C: WideString;
  var Pos: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.StrChPosW(P, C[1], Cardinal(Pos));
end;

function TStString.StrStCopy(const S: WideString; Pos,
  Count: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.StrStCopyW(S, Cardinal(Pos), Cardinal(Count));
end;

function TStString.StrStDelete(const S: WideString; Pos,
  Count: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.StrStDeleteW(S, Cardinal(Pos), Cardinal(Count));
end;

function TStString.StrStInsert(const S1, S2: WideString;
  Pos: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.StrStInsertW(S1, S2, Cardinal(Pos));
end;

function TStString.StrStPos(const P, S: WideString;
  var Pos: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.StrStPosW(P, S, Cardinal(Pos));
end;

function TStString.StrWithin(const S, SearchStr: WideString;
  Start: Integer; var Position: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.StrWithinW(S, SearchStr, Cardinal(Start), Cardinal(Position));
end;

function TStString.Substitute(const S, FromStr,
  ToStr: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.SubstituteW(S, FromStr, ToStr);
end;

function TStString.Trim(const S: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.TrimW(S);
end;

function TStString.TrimChars(const S, Chars: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.TrimCharsW(S, Chars);
end;

function TStString.TrimLead(const S: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.TrimLeadW(S);
end;

function TStString.TrimSpaces(const S: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.TrimSpacesW(S);
end;

function TStString.TrimTrail(const S: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.TrimTrailW(S);
end;

function TStString.ValPrep(const S: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.ValPrepW(S);
end;

function TStString.WordCount(const S, WordDelims: WideString): Integer;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.WordCountW(S, WordDelims);
end;

function TStString.WordPos(const S, WordDelims, AWord: WideString;
  N: Integer; var Position: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.WordPosW(S, WordDelims, AWord, Cardinal(N), Cardinal(Position));
end;

function TStString.WordPosition(N: Integer; const S,
  WordDelims: WideString; var Position: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrW.WordPositionW(Cardinal(N), S, WordDelims, Cardinal(Position));
end;

procedure TStString.WordWrap(const InSt: WideString; var OutSt,
  Overlap: WideString; Margin: Integer; PadToMArgin: WordBool);
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  StStrW.WordWrapW(InSt, OutSt, Overlap, Cardinal(Margin), PadToMargin);
end;

function TStString.License(const Key: WideString): WordBool;
begin
  {$IFDEF LICENSE}
  Result := COMIsValidKey(Key);

  { License the objects used in this class }
  FTokens.License(Key);

  {$ELSE}
  Result := True;
  {$ENDIF}
  FIsLicensed := Result;
end;

function TStString.Soundex(const S: WideString): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StStrL.SoundexL(S);
end;

initialization
  TAutoObjectFactory.Create(ComServer, TStString, Class_StString, ciMultiInstance, tmBoth);
end.

⌨️ 快捷键说明

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