Re: Substring with unknown length (newbie)
NewStr := Copy(OldStr, 1, Pos('>', OldStr);
Delphi puts a #0 at the end of every string so that one can readily
typecast to a "pointer to char" by using PChar(MyStr). This is
effectively the same as ...
MyStr := MyStr + #0;
MyPChar := @MyStr[1];
So having copied the first part of the string up to and including the
'>', one can use it as a pointer-to-zero-terminated-string by coding
....
PChar(NewStr)
Alan Lloyd
.
Relevant Pages
- Re: split a string
... But this reads a string into a single char ... Check fgetsfrom the Standard C Library as a way to get string input ... pointer to a pointer to a char. ... To handle arrays remotely. ... (alt.comp.lang.learn.c-cpp) - Re: copy a string into a 2d array of chars
... This split function should allocate a 2D array of chars ... >focus the program the string is not actually split. ... later) is an array of char containing the original contents of the ... The i-th pointer will contain the starting address of the ... (comp.lang.c) - Re: problem with function
... > If you intended copying the string, you need to use the strcpy function. ... I suggest researching hungarian notation for variable names. ... Isn't 'psz' a pointer a an array of characters containing a string? ... pointer to char. ... (alt.comp.lang.learn.c-cpp) - Re: function (const char *) vs. function (char *)
... The type of "String" ... > is `char*', not `const char*', so you can pass it to myfunc ... course like other arrays it is converted to a pointer to its first element ... pass it directly to a function that takes a const char * argument but not ... (comp.lang.c) - Re: type of "string"
... Well, the above writing doesn't have anything named "String", so I can't ... The function foo is declared as taking pointer to char. ... That is why compiler gives you a warning. ... (comp.lang.c.moderated) |
|