archive-com.com » COM » E » EFG2.COM

Total: 878

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • 3 Organization PhR Reply To Philippe Ranger Newsgroups borland public delphi objectpascal Procedure show Var s s1 sM string Begin s X talks to X about x sM Original s M J M J s1 stringReplace s X Vern sM sM Plain StringReplace s1 M J M J s1 stringReplace s X Vern rfReplaceAll sM sM With rfReplaceAll s1 M J M J s1 stringReplace s X Vern rfIgnoreCase sM

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/1206.txt (2016-02-14)
    Open archived version from archive


  • the newline you can do this with a OnDrawCell handler for the grid procedure TForm1 StringGrid1DrawCell Sender TObject Col Row Integer Rect TRect State TGridDrawState var S String drawrect trect begin S Sender As TStringgrid Cells Col Row If Length S 0 Then Begin drawrect rect DrawText Sender As TStringgrid canvas handle Pchar S Length S drawrect dt calcrect or dt wordbreak or dt left If drawrect bottom drawrect top

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0403.txt (2016-02-14)
    Open archived version from archive


  • Mime Version 1 0 Newsgroups borland public delphi vcl components using Tom Alexander wrote How do I make the fixed row font and text centering different than the remainder of the rows in a TStringGrid component Just handle the OnDrawCell event procedure TForm1 StringGrid1DrawCell Sender TObject ACol ARow Integer Rect TRect State TGridDrawState var Format integer begin if ARow 0 then Format DT SINGLELINE or DT VCENTER or DT CENTER

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2000/0720.txt (2016-02-14)
    Open archived version from archive


  • sLength 1 sLength ELSE RESULT Copies sLength LENGTH s s END Right FUNCTION Copies CONST s STRING CONST n TStrIndex STRING VAR i TStrIndex t STRING BEGIN t FOR i 1 TO n DO AppendStr t s RESULT t END Copies FUNCTION CountChar CONST s STRING CONST c CHAR TStrIndex VAR i TStrIndex BEGIN RESULT 0 FOR i 1 TO LENGTH s DO IF s i c THEN INC RESULT END CountChar DeleteString is NOT like the original REXX DelStr function DeleteString deletes a given string if present To delete a word from a sentence add a blank to the beginning and end of the strings e g DeleteString Bill Bill Preston Earl FUNCTION DeleteString CONST substring STRING CONST s STRING STRING VAR i TStrIndex t STRING BEGIN t s i POS substring t IF i 0 THEN Delete t i LENGTH substring RESULT t END DeleteString FUNCTION Overlay CONST ovly target STRING CONST n TStrIndex STRING VAR i TStrIndex sLength TStrIndex t STRING BEGIN sLength LENGTH Target IF n LENGTH ovly 1 sLength THEN sLength n LENGTH ovly 1 t Left target sLength FOR i 1 TO LENGTH ovly DO t n i 1 ovly i RESULT t END Overlay FUNCTION Plural CONST n LongInt CONST singularform pluralform STRING STRING BEGIN function similar to one on p 314 Byte December 1988 IF n 1 THEN RESULT singularform ELSE IF pluralform THEN RESULT singularform s ELSE RESULT pluralform END Plural FUNCTION Reverse CONST s STRING STRING VAR i TStrIndex j TStrIndex t STRING BEGIN t j LENGTH s 1 FOR i 1 TO LENGTH s DO AppendStr t s j i RESULT t END Reverse FUNCTION Space CONST s STRING CONST n TStrIndex STRING VAR i TStrIndex state 0 2 state of finite state machine t STRING BEGIN t state 0 FOR i 1 TO LENGTH s DO CASE state OF 0 IF s i THEN BEGIN state 1 AppendStr t Copies n s i END END RESULT t END Space FUNCTION Strip CONST s STRING CONST option STRING STRING VAR c CHAR i TStrIndex t STRING BEGIN t s IF LENGTH option 0 THEN c UpCase option 1 ELSE c B IF c T THEN c B IF c L OR c B AND LENGTH t 0 Leading or Both THEN BEGIN i 1 WHILE t i AND i 0 Trailing or Both THEN BEGIN i LENGTH t WHILE t i AND i 0 DO i i 1 t COPY t 1 i END RESULT t END Strip FUNCTION TestString CONST sLength TStrIndex STRING VAR i TStrIndex BEGIN RESULT FOR i 1 TO sLength DO AppendStr RESULT CHR 48 Random 79 END TestString FUNCTION Translate CONST s OutTable InTable STRING STRING VAR Flag ARRAY 0 255 OF BOOLEAN i j n TStrIndex t STRING Table ARRAY 0 255 OF CHAR BEGIN FOR i 0 TO 255 DO BEGIN Table i CHR i Flag i TRUE END IF LENGTH OutTable start THEN BEGIN FOR i start TO stop DO AppendStr

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/Strings/REXX.pas.TXT (2016-02-14)
    Open archived version from archive


  • or exists a unit who extracts substrings which are separated by spaces f e to extract the substrings ARG1 and ARG2 of the string PROGRAM ARG1 ARG2 Function IScan Parameters ch Character to scan for S String to scan fromPos first character to scan Returns position of next occurence of character ch or 0 if none found Description Search for next occurence of a character in a string Error Conditions none Created 11 27 96 by P Below Function IScan ch Char Const S String fromPos Integer Integer Var i Integer Begin Result 0 For i fromPos To Length S Do Begin If S i ch Then Begin Result i Break End If End For End IScan Procedure SplitString Parameters S String to split separator character to use as separator between substrings substrings list to take the substrings Description Isolates the individual substrings and copies them into the passed stringlist Note that we only add to the list we do not clear it first If two separators follow each other directly an empty string will be added to the list Error Conditions will do nothing if the stringlist is not assigned Created 08 07 97 by P Below Procedure SplitString

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2000/0524b.txt (2016-02-14)
    Open archived version from archive


  • Mime Version 1 0 Newsgroups borland public delphi objectpascal Martin Kelly wrote Is there a more efficient way of removing the comma characters from a string function RemoveCommas aStr String String begin Remove Comma s from String e g 1 000 000 00 will now read 1000000 00 while Pos aStr 0 do Delete aStr Pos AStr 1 Result aStr end I could only come up with the above Just

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0423b.txt (2016-02-14)
    Open archived version from archive


  • untested Procedure ReplaceInFile const filename String const findbytes replacebytes Array of byte Function BytesToString const bytes Array of byte String Begin SetLength result High bytes Low bytes 1 If length result 0 Then Move bytes 0 result 1 length result End BytesToString Var S String f TFileStream findStr replaceStr String Begin convert array of bytes to strings findStr BytesToString findbytes replaceStr BytesToString replacebytes open file and read it into a

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0810a.txt (2016-02-14)
    Open archived version from archive


  • LongInt returns position of string in file or 1 if not found Const BufferSize 8001 32K 1 bytes Var pBuf pEnd pScan pPos Pchar filesize LongInt bytesRemaining LongInt bytesToRead Word F File SearchFor Pchar oldMode Word Begin Result 1 assume failure If Length forString 0 or Length filename 0 Then Exit SearchFor Nil pBuf Nil open file as binary 1 byte recordsize AssignFile F filename oldMode FileMode FileMode 0 read only access Reset F 1 FileMode oldMode try allocate memory for buffer and pchar search string SearchFor StrAlloc Length forString 1 StrPCopy SearchFor forString If not caseSensitive Then convert to upper case AnsiUpper SearchFor GetMem pBuf BufferSize filesize System Filesize F bytesRemaining filesize pPos Nil While bytesRemaining 0 Do Begin calc how many bytes to read this round If bytesRemaining BufferSize Then bytesToRead Pred BufferSize Else bytesToRead bytesRemaining read a buffer full and zero terminate the buffer BlockRead F pBuf bytesToRead bytesToRead pEnd pBuf bytesToRead pEnd 0 scan the buffer Problem buffer may contain 0 chars So we treat it as a concatenation of zero terminated strings pScan pBuf While pScan Nil Then Begin Found it Result FileSize bytesRemaining LongInt pPos LongInt pBuf Break End pScan StrEnd pScan Inc pScan

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0716c.txt (2016-02-14)
    Open archived version from archive



  •