var
text : array[8] of char;
text:=' 56789'; //has 3 spaces at beginning of string
code
StrReplChr(text,' ','0');
Lcd_Out(1,1,text);
result of this on LCD is '00000056789' but
shouldn't this be '00056789' ?
text:string[8];
Thanks
bryan
new conversion library is ready
Re: StrReplChr question
It surely should if there were three spaces to be replaced. StrReplChr certainly does not add zeroes to string (BTW, it belongs to Strings lib, not conversions). Without more information I can't say what is the problem, but it's not in StrReplChr.Briansw wrote: result of this on LCD is '00000056789' but
shouldn't this be '00056789' ?
OK, found the problem.
Even if I did this.
text:string[1];
and then this
LongintToStr(12234567,text);
LongIntToStr will resize text[1] so that the longint will fit. It will resize it to text[11]; That explains the extra 0's I'm getting. Look at the help file and it says longinttostr needs a string[11]. So it must somehow resize the string to fit the conversion. Bug in mikroep? I can load a lonngint into a string or array of 1 and display the entire longint on a LCD.
Even if I did this.
text:string[1];
and then this
LongintToStr(12234567,text);
LongIntToStr will resize text[1] so that the longint will fit. It will resize it to text[11]; That explains the extra 0's I'm getting. Look at the help file and it says longinttostr needs a string[11]. So it must somehow resize the string to fit the conversion. Bug in mikroep? I can load a lonngint into a string or array of 1 and display the entire longint on a LCD.
This is mikroPascal forum, so libraries presented here certainly won't work with any PRO compilers.
BUT , for the next PRO versions release I'm preparing a set of libraries that should work with all PRO compilers for PIC18 processors. Most of them will be official lib replacements, like strings, conversions, and floating-point math libs.
mC versions will require more work - some libs will need header files - so it'll take more time. Note also that the libs are aimed at extending mikroPascal, so behaviour of some routines may differ from known in ANSI C.
BUT , for the next PRO versions release I'm preparing a set of libraries that should work with all PRO compilers for PIC18 processors. Most of them will be official lib replacements, like strings, conversions, and floating-point math libs.
mC versions will require more work - some libs will need header files - so it'll take more time. Note also that the libs are aimed at extending mikroPascal, so behaviour of some routines may differ from known in ANSI C.