来自:http://www.aspww.cn/View/12022801.aspx ------------------------------------------------------------ var aStr: String; begin aStr := 'This is a book, not a pen!'; ShowMessage(StringReplace (aStr, 'a', 'two', []));//This is two book, not a pen!只替换了第…
1. 提取字符串中指定子字符串前的字符串 Function Before( Src:string ; S:string ): string ; Var F: Word ; begin F:= POS(Src,S) ; if F=0 then Before := S else Before := COPY(S,1,F-1) ; end ; eg: Before('123','helloworld_123') 返回结果:helloworld_ 2. …