Re: TStringGrid



That code I posted was really dubious - I had similarly been hit by a
zero length string and so the code in my utility file ia now ...

procedure WriteStreamStr(Stream : TStream; Str : string);
{writes a string to the stream}
var
StrLen : integer;
begin
{get length of string}
StrLen := Length(Str);
{write length of string}
WriteStreamInt(Stream, StrLen);
if StrLen > 0 then
{write characters}
Stream.WriteBuffer(Str[1], StrLen);
end;

function ReadStreamStr(Stream : TStream) : string;
{returns a string from the stream}
var
LenStr : integer;
begin
Result := '';
{get length of string}
LenStr := ReadStreamInt(Stream);
{set string to get memory}
SetLength(Result, LenStr);
if (LenStr = 0) then
Exit;
{read characters}
Stream.ReadBuffer(Result[1], LenStr);
end;

Alan Lloyd

.



Relevant Pages

  • Re: package javascript
    ... | hasValidChars:function(string, characters, caseSensitive){ ... One could argue that the empty string always meets the requirement. ... | var cArr = new Array; ...
    (comp.lang.javascript)
  • Re: listing all matches - JSCRIPT under WSH REGEX - NEWBIE
    ... Your RegExp does not find the first instance of CCC. ... Text files are a sequence of characters ... need it to list every line with the string. ... var fso = new ActiveXObject; ...
    (microsoft.public.scripting.jscript)
  • Re: Capittel letter
    ... > in an editfield becomes a capittel letter when leaving that editfield ... I wrote this code in which I defined some characters I wish their following ... function TForm1.UpperLowerCase(Text: string): string; ...
    (borland.public.delphi.ide)
  • Re: selecting text in a div
    ... is the count of characters from the end of the string. ... I have no trouble locatin gthe div and setting the starting position of ... var r1 = document.body.createTextRange; ...
    (comp.lang.javascript)
  • Re: How to find out if its a Number or String character?
    ... That's not the _first_ three characters, to get that you must use ... function IsInteger(s: string): boolean; ... var i: integer; ... If you need to check that _all_ the given positions are digits change ...
    (borland.public.delphi.language.objectpascal)