标签:keditor ima color img integer HTST pre begin net
自己收集的几个比较实用的字符串函数(LeftStr,MidStr,RightStr,Reverse,LastPos)
没什么可说的,自己看啦
//从右边取 function RightStr (Const Str: String; Size: Word): String; begin if Size > Length(Str) then Size := Length(Str) ; RightStr := Copy(Str, Length(Str)-Size+1, Size) end; //从中间取 function MidStr (Const Str: String; From, Size: Word): String; begin MidStr := Copy(Str, From, Size) end; //从左边取 function LeftStr (Const Str: String; Size: Word): String; begin LeftStr := Copy(Str, 1, Size) end; //翻转字符串 Function Reverse(S : String): String; Var i : Integer; Begin Result := ‘‘; For i := Length(S) DownTo 1 Do Begin Result := Result + Copy(S,i,1) ; End; End; //取最后一个字串的位置 function LastPos(const SubStr: String; const S: String): Integer; begin result := Pos(Reverse(SubStr), Reverse(S)) ; if (result <> 0) then result := ((Length(S) - Length(SubStr)) + 1) - result + 1; end;
标签:keditor ima color img integer HTST pre begin net
原文地址:https://www.cnblogs.com/jijm123/p/13264399.html