Board index » delphi » Null-terminated to Un-Null-terminated?
Jesse Castleberry
![]() Delphi Developer |
Tue, 03 Oct 2000 03:00:00 GMT
|
Jesse Castleberry
![]() Delphi Developer |
Tue, 03 Oct 2000 03:00:00 GMT
Null-terminated to Un-Null-terminated?How do I change a Null-terminated string to an Un-Null-terminated string? I'm using the following code. cString Contains 'J:\MYFILE\STUFF.TXT' when It's set here. As you can see, Thanks for any help Jesse |
Mike Powel
![]() Delphi Developer |
Tue, 03 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?QuoteJesse Castleberry wrote: from String and PChar types. String of course is the expected Pascal style strings PChar on the other hand is Borland Delphi's implementation of null terminated strings. |
Ken Whit
![]() Delphi Developer |
Tue, 03 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?Jesse, I just tested using your sample string, and Delphi tells me the I tested by dropping three labels on a form, and doing the following Label1.Caption := 'J:\MYFILE\STUFF.TXT'; Label2 displayed 19, and Label3 displayed 'STUFF.TXT'. BTW, an easier way if you're dealing with filenames is to use the Label3.Caption := ExtractFileName(Label1.Caption); You'd get the same thing without being as dependent on the exact HTH Ken Clipper Functions for Delphi QuoteJesse Castleberry wrote: |
AlanGLLo
![]() Delphi Developer |
Wed, 04 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?In article <6h8i8f$44...@news2.ispnews.com>, "Jesse Castleberry" Quote<D...@iThink.net> writes: cString := Copy(cString,11,Length(cString)); . . the function only copies to the end of the string, and its one thing less Alan Lloyd |
ullr..
![]() Delphi Developer |
Wed, 04 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?In article <6h8i8f$44...@news2.ispnews.com>, Quote
makes you think Delphi thinks it's 20? Showmessage(inttostr(Length('J:\MYFILE\STUFF.TXT'))); Exactly what are you trying to accomplish, and what's going wrong? David C. Ullrich -----== Posted via Deja News, The Leader in Internet Discussion ==----- |
Dirk Claessen
![]() Delphi Developer |
Wed, 04 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?AlanGLLoyd heeft geschreven in bericht Quote|<D...@iThink.net> writes: |>cString := Copy(cString,11,Length(cString) - 10); | |You're better using :- | |cString := Copy(cString,11,Length(cString)); | |. . the function only copies to the end of the string, and its one thing |less to change if you change your program. <g> Alan: I've noticed this behaviour of the Copy() function too, but never TIA, |
ullr..
![]() Delphi Developer |
Thu, 05 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?In article <6hash6$3v...@xenon.inbe.net>, Quote
question you _might_ find an answer to in there somewhere. Let's see, under Copy it says Description The Copy function returns a substring of a string. Sure enough. David C. Ullrich -----== Posted via Deja News, The Leader in Internet Discussion ==----- |
Dirk Claessen
![]() Delphi Developer |
Fri, 06 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?ullr...@math.okstate.edu heeft geschreven in bericht <6hdet9 Well... that's what I _always_ do, as well as pointing out to other Bye |
Jan Wezeli
![]() Delphi Developer |
Sat, 07 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?QuoteD...@iThink.net ("Jesse Castleberry"),comp writes: might think, since the first entry(actually location 0 [zero]) is the value that Lenght reads, because it holds the number of characters in the line. But if you are 100% sure that there are a Null character in the end, and that it when you try to get rid of it, you lose on of your characters, then I'm not sure if maybe you have misunderstood something, or if I have... Anyhowe, tried to Copy() the number of characters you wanted, and seen if you still are returnd with the same problem? (This is not a solution, but a way to test if there indeed are an extra character in the end...kinda...) //Da -Z- |
ullr..
![]() Delphi Developer |
Sun, 08 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?In article <6him19$pe...@xenon.inbe.net>, Quote
ancient function I wouldn't have tried to look it up either... -----== Posted via Deja News, The Leader in Internet Discussion ==----- |
Carl Zmo
![]() Delphi Developer |
Tue, 10 Oct 2000 03:00:00 GMT
Re:Null-terminated to Un-Null-terminated?On Mon, 20 Apr 1998 20:54:18 +0200, "Dirk Claessens" Quote<Dirk.Claessens@village.#NOSPAM#uunet.be> wrote: there was some good help on converting between string types. For the most part D3 help files are a big improvement, but not for string related functions. Carl |